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

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

RPMDIR=$(rpm -E %_rpmdir)

RPM=$(find ${RPMDIR} -name "trinity-${PKGNAME}-[0-9]*.rpm" | sort -n | tail -n 1)

if [ ! -r "${RPM}" ]; then
  RPM=$(find ${RPMDIR} -name "${PKGNAME}-[0-9]*.rpm" | sort -n | tail -n 1)
  if [ ! -r "${RPM}" ]; then
    echo "Error, cannot find any package for '${PKGNAME}' !"
    exit 1
  fi
fi

echo $RPM