File: version.sh

package info (click to toggle)
n2n 3.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,776 kB
  • sloc: ansic: 29,672; sh: 1,502; python: 621; makefile: 442; perl: 270; exp: 4
file content (36 lines) | stat: -rwxr-xr-x 614 bytes parent folder | download
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