get_version.sh (442B)
1 #!/bin/sh 2 # This file is in the public domain. 3 # Gets the version number from VCS, or from the contents of the file $1 4 version= 5 if test -f "$1" 6 then 7 version=$(cat $1) 8 fi 9 if test "x$version" = "x" -a -d "./.git" 10 then 11 version=$(git log -1 | grep 'commit [a-f0-9]\+' | sed -e 's/commit //') 12 if test ! "x$version" = "x" 13 then 14 version="git-$version" 15 fi 16 fi 17 if test "x$version" = "x" 18 then 19 version="unknown" 20 fi 21 echo $version