summaryrefslogtreecommitdiffstats
path: root/redhat/build/get_spec_version.sh
diff options
context:
space:
mode:
Diffstat (limited to 'redhat/build/get_spec_version.sh')
-rwxr-xr-xredhat/build/get_spec_version.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/redhat/build/get_spec_version.sh b/redhat/build/get_spec_version.sh
new file mode 100755
index 000000000..82c61dcd8
--- /dev/null
+++ b/redhat/build/get_spec_version.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+PKGNAME="${1##*/}"
+TDE_VERSION="${2:-14.0.0}"
+
+[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
+
+SPECFILE=$(get_specfile.sh ${PKGNAME} ${TDE_VERSION})
+
+[ ! -r "${SPECFILE}" ] && exit 2
+
+VERSION=$(sed -n "/^Version:/ s/Version:[ ]*//p" ${SPECFILE})
+RELEASE=$(sed -n "/^Release:/ s/Release:[ ]*//p" ${SPECFILE})
+VERSION=$(rpm -E "${VERSION}")
+RELEASE=$(rpm -E "${RELEASE}")
+RELEASE=${RELEASE%$(rpmdist.sh --dist)}
+
+echo ${VERSION}-${RELEASE}