| 1 | #!/bin/sh |
| 2 | |
| 3 | if [ -f ${1}/.version ]; then |
| 4 | cat ${1}/.version |
| 5 | elif [ -d ${1}/.git ]; then |
| 6 | VERSION=`git describe --tags --dirty=M 2> /dev/null | sed -e "s/^v\([0-9]\)/\1/"` |
| 7 | if [ $? -ne 0 ]; then |
| 8 | MODIFIED="" |
| 9 | if [ "`git ls-files -m | wc -l`" != "0" ]; then |
| 10 | MODIFIED="M" |
| 11 | fi |
| 12 | # Some older versions of git do not support all the above |
| 13 | # options. |
| 14 | VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED} |
| 15 | fi |
| 16 | echo ${VERSION} |
| 17 | else |
| 18 | # Use the directory information in the absence of any other version |
| 19 | # information |
| 20 | pwd -P |
| 21 | fi |