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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#!/bin/sh
#
# $Copyright$
#
# $Id: get_lam_version,v 1.1 2000/10/24 17:39:34 jsquyres Exp $
#
# Since we do this in multiple places, it's worth putting in a
# separate shell script. Very primitive script to get the version
# number of LAM into a coherent variable. Can query for any of the
# individual parts of the version number, too.
#
srcdir="$1"
option="$2"
if test "$srcdir" = ""; then
option="--help"
else
LAM_MAJOR_VERSION="`cat $srcdir/VERSION | grep major | cut -d= -f2`"
LAM_MINOR_VERSION="`cat $srcdir/VERSION | grep minor | cut -d= -f2`"
LAM_RELEASE_VERSION="`cat $srcdir/VERSION | grep release | cut -d= -f2`"
LAM_ALPHA_VERSION="`cat $srcdir/VERSION | grep alpha | cut -d= -f2`"
LAM_BETA_VERSION="`cat $srcdir/VERSION | grep beta | cut -d= -f2`"
if test "$LAM_RELEASE_VERSION" != "0" -a "$LAM_RELEASE_VERSION" != ""; then
LAM_VERSION="$LAM_MAJOR_VERSION.$LAM_MINOR_VERSION.$LAM_RELEASE_VERSION"
else
LAM_VERSION="$LAM_MAJOR_VERSION.$LAM_MINOR_VERSION"
fi
if test "`expr $LAM_ALPHA_VERSION \> 0`" = "1"; then
LAM_VERSION="${LAM_VERSION}a$LAM_ALPHA_VERSION"
elif test "`expr $LAM_BETA_VERSION \> 0`" = "1"; then
LAM_VERSION="${LAM_VERSION}b$LAM_BETA_VERSION"
fi
if test "$option" = ""; then
option="--full"
fi
fi
case "$option" in
--full|-v|--version)
echo $LAM_VERSION
;;
--major)
echo $LAM_MAJOR_VERSION
;;
--minor)
echo $LAM_MINOR_VERSION
;;
--release)
echo $LAM_RELEASE_VERSION
;;
--alpha)
echo $LAM_ALPHA_VERSION
;;
--beta)
echo $LAM_BETA_VERSION
;;
-h|--help)
cat <<EOF
$0 <srcdir> [<option>]
<srcdir> - Top-level directory of the LAM source tree
<option> - One of:
--full - Full version number
--major - Major version number
--minor - Minor version number
--release - Release version number
--alpha - Alpha version number
--beta - Beta version nmumber
--help - This message
EOF
esac
exit 0
|