summaryrefslogtreecommitdiffstats
path: root/redhat/build/get_latest_built_package_version.sh
blob: 44d3896b65c64ecf8f40ce6b001f9f822c4ad937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

PKGNAME="$1"
TDE_VERSION="${2:-14.0.0}"

[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1

RPM=$(get_latest_built_package_filename.sh "${PKGNAME}" ${TDE_VERSION})

[ ! -r "${RPM}" ] && echo "No package found for '${PKGNAME}' !" && exit 2

VERSION=$(rpm -qp --qf "%{version}-%{release}" "${RPM}")
VERSION=${VERSION%.opt} # Remove '.opt' suffix
VERSION=${VERSION%.[a-z]*} # Remove distro suffix (e.g. '.el6')
VERSION=${VERSION/-*_0_/\~}

echo $VERSION