version (412B)
1 #!/bin/sh 2 # Distro packagers may set the LOCALVER variable to add their distribution to 3 # the version, e.g. 1.0-alpine. 4 VERSION=${VERSION:-dev} 5 6 ver=$(git describe 2>/dev/null) 7 if [ $? -ne 0 ] 8 then 9 ver="dev+$(git log -1 --format='%h' 2>/dev/null)" 10 if [ $? -ne 0 ] 11 then 12 # git presumed unavailable 13 ver=$VERSION 14 fi 15 fi 16 17 localver=${LOCALVER:-} 18 if [ ${#localver} != 0 ] 19 then 20 ver="$ver-$localver" 21 fi 22 echo $ver