summaryrefslogtreecommitdiffstats
path: root/redhat/build/is_latest_package_installed.sh
diff options
context:
space:
mode:
Diffstat (limited to 'redhat/build/is_latest_package_installed.sh')
-rwxr-xr-xredhat/build/is_latest_package_installed.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/redhat/build/is_latest_package_installed.sh b/redhat/build/is_latest_package_installed.sh
new file mode 100755
index 000000000..6e1ed79d0
--- /dev/null
+++ b/redhat/build/is_latest_package_installed.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+PKGNAME="${1##*/}"
+TDE_VERSION="${2:-14.0.0}"
+
+INSTALLED=$(get_installed_package_version.sh ${PKGNAME})
+TARBALL=$(get_latest_tarball_version.sh ${PKGNAME} ${TDE_VERSION})
+SPEC=$(get_spec_version.sh ${PKGNAME} ${TDE_VERSION})
+
+# Package containing "~" (e.g. R14 preversion tarballs):
+if [ "${INSTALLED/\~/}" != "${INSTALLED}" ]; then
+ if [ "${INSTALLED#*\~}" = "${TARBALL#*\~}" ]; then
+ echo "Latest package '${PKGNAME}' version '${TARBALL}' is already built and installed."
+ exit 0
+ fi
+else
+ # Other package (e.g. akode)
+ if [ "${INSTALLED%-*}" = "${TARBALL%-*}" ]; then
+ echo "Latest package '${PKGNAME}' version '${INSTALLED}' is already built and installed."
+ exit 0
+ fi
+
+ # Other package (e.g. QT3)
+ if [ "${INSTALLED}" = "${SPEC}" ]; then
+ echo "Latest package '${PKGNAME}' version '${INSTALLED}' is already built and installed."
+ exit 0
+ fi
+fi
+
+exit 1