summaryrefslogtreecommitdiff
path: root/version.sh
blob: 8cde8f0ca81740fd0946999cd65489df70258b73 (plain)
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
#!/bin/sh

if [ -f VERSION ]
then
    ver="`cat VERSION`"
    rev="`sed -e 's/^r\([0-9]\+\).*$/\1/' VERSION`"
elif [ -x "`which git`" -a -d ".git" ]
then
    rev="`git rev-list HEAD | wc -l | tr -d -c 0-9`"
    ver="r$rev~`git rev-parse --short HEAD`"
else
    echo "WARNING: Couldn't detect Q2PRO version." >&2
    ver="r666"
    rev="666"
fi

case $1 in
--version|-v)
    echo $ver;;
--revision|-r)
    echo $rev;;
*)
    echo $ver
    echo $rev;;
esac