You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tde-packaging/redhat/build/get_latest_built_package_ve...

27 lines
808 B

#!/bin/bash
PKGNAME="$1"
TDE_VERSION="${2:-${TDE_VERSION:-14.1.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
pkg_version="$(rpm -qp --qf "%{version}" "${RPM}")"
pkg_release="$(rpm -qp --qf "%{release}" "${RPM}")"
# Application packages: version does not match TDE version
if [[ "${pkg_release}" =~ _0_ ]] || [[ "${pkg_release}" =~ ${TDE_VERSION}_ ]] ; then
eval VERSION="${pkg_release/_0_/\~}"
else
# Base package (tdelibs ...)
eval VERSION="${pkg_version}_${pkg_release/0_/\~}"
fi
VERSION="${VERSION%.opt}" # Remove '.opt' suffix
VERSION="${VERSION%.[a-z]*}" # Remove distro suffix (e.g. '.el6')
echo "${VERSION}"