get_version.sh (325B)
1 #!/bin/sh 2 # Gets the version number from git, or from the contents of .version 3 VERSION= 4 if test -f ".version" 5 then 6 VERSION=$(cat .version) 7 fi 8 if test -d "./.git" 9 then 10 VERSION=$(git describe --tags) 11 VERSION=${VERSION#v} 12 echo $VERSION > .version 13 fi 14 if test "x$VERSION" = "x" 15 then 16 VERSION="unknown" 17 fi 18 echo "$VERSION"