summaryrefslogtreecommitdiffstats
path: root/redhat/build/get_latest_tarball_filename.sh
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2014-01-24 20:46:50 +0100
committerFrançois Andriot <albator78@libertysurf.fr>2014-01-24 20:46:50 +0100
commit43429e67cfc03fdf5065e90c197753ec5f15aa19 (patch)
tree3f85e6c48280c03682aa2aa92fca68fd9aa60634 /redhat/build/get_latest_tarball_filename.sh
parentdf55195d132cbe6af516c6f1883315f26abd7f4a (diff)
downloadtde-packaging-43429e67cfc03fdf5065e90c197753ec5f15aa19.tar.gz
tde-packaging-43429e67cfc03fdf5065e90c197753ec5f15aa19.zip
RPM Packaging: update build scripts
Diffstat (limited to 'redhat/build/get_latest_tarball_filename.sh')
-rwxr-xr-xredhat/build/get_latest_tarball_filename.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/redhat/build/get_latest_tarball_filename.sh b/redhat/build/get_latest_tarball_filename.sh
new file mode 100755
index 000000000..8cc39f65d
--- /dev/null
+++ b/redhat/build/get_latest_tarball_filename.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+PKGNAME="${1##*/}"
+TDE_VERSION="${2:-14.0.0}"
+
+[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
+[ -d "${TARBALLS_DIR}" ] || TARBALLS_DIR=~/tde/tde-tarballs/${TDE_VERSION}/
+[ -d "${PACKAGING_DIR}" ] || PACKAGING_DIR=~/tde/tde-packaging/redhat/
+
+RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-[0-9]*.tar.gz" | sort -n | tail -n 1)
+if [ ! -r "${RET}" ]; then
+ # Retry without 'trinity-*', and allow any TAR extension.
+ RET=$(find "${PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1)
+ if [ ! -r "${RET}" ]; then
+ # Retry by removing numbers in package name, e.g "imlib1" => "imlib"
+ RET=$(find "${PACKAGING_DIR}" -name "$(tr -d "[0-9]" <<< ${PKGNAME})-[0-9]*.tar*" | sort -n | tail -n 1)
+ fi
+fi
+
+[ -z "${RET}" ] && exit 2
+
+echo "${RET}"
+exit 0