diff --git a/scripts/getrevision.sh b/scripts/getrevision.sh index ae875a630..f3049b541 100755 --- a/scripts/getrevision.sh +++ b/scripts/getrevision.sh @@ -1,10 +1,21 @@ #!/bin/bash -#git show-ref refs/heads/master | cut -d " " -f 1 | cut -c 1-10 -if [ -e "/usr/bin/git" ] && [ -e ".git" ]; then - git show-ref refs/heads/master | cut -d " " -f 1 | cut -c 1-10; +REV="" + +if [ -e "/usr/bin/git" ] && ([ -e ".git" ] || [ -e "../.git" ]); then + REV=`git show-ref refs/heads/master | cut -d " " -f 1` elif [ -e "git_revision" ]; then - cat git_revision | cut -c 1-10; + REV=`cat git_revision` fi +case $1 in + long) + echo $REV + ;; + + short|*) + echo $REV | cut -c 1-10 + ;; +esac + exit;