2005-12-28 01:40:17 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
GVF=GIT-VERSION-FILE
|
2006-01-10 05:07:01 +03:00
|
|
|
DEF_VER=v1.1.GIT
|
2005-12-28 01:40:17 +03:00
|
|
|
|
2006-01-10 05:07:01 +03:00
|
|
|
# First try git-describe, then see if there is a version file
|
|
|
|
# (included in release tarballs), then default
|
2006-01-16 11:58:45 +03:00
|
|
|
VN=$(git-describe --abbrev=4 HEAD 2>/dev/null | sed -e 's/-/./g') ||
|
2006-01-10 05:07:01 +03:00
|
|
|
VN=$(cat version) ||
|
|
|
|
VN="$DEF_VER"
|
|
|
|
|
|
|
|
VN=$(expr "$VN" : v*'\(.*\)')
|
2006-01-10 01:25:10 +03:00
|
|
|
|
|
|
|
dirty=$(sh -c 'git-diff-index --name-only HEAD' 2>/dev/null) || dirty=
|
|
|
|
case "$dirty" in
|
|
|
|
'')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
VN="$VN-dirty" ;;
|
|
|
|
esac
|
|
|
|
|
2005-12-28 01:40:17 +03:00
|
|
|
if test -r $GVF
|
|
|
|
then
|
|
|
|
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
|
|
|
|
else
|
|
|
|
VC=unset
|
|
|
|
fi
|
|
|
|
test "$VN" = "$VC" || {
|
|
|
|
echo >&2 "GIT_VERSION = $VN"
|
|
|
|
echo "GIT_VERSION = $VN" >$GVF
|
|
|
|
}
|
|
|
|
|
|
|
|
|