1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#!/bin/sh
#
# Output the current version number
#
usage() {
echo "Usage: $0 [short|hash]"
echo
echo "Determine the correct version number for the current build"
exit 0
}
# We assume this script is in the TOPDIR/scripts directory and use that
# to find any other files we need
TOPDIR=$(dirname "$0")/..
VER_FILE_SHORT=$(cat "${TOPDIR}/VERSION")
VER_SHORT="$VER_FILE_SHORT"
VER_HASH="HEAD"
VER="$VER_FILE_SHORT"
case "$1" in
hash)
echo "$VER_HASH"
;;
short)
echo "$VER_SHORT"
;;
"")
echo "$VER"
;;
*)
usage
;;
esac
|