41 lines
743 B
Bash
Executable File
41 lines
743 B
Bash
Executable File
#!/bin/sh
|
|
|
|
GVF=$1
|
|
APP=$2
|
|
DEF_VER=UNKNOWN
|
|
|
|
# First see if there is a version file (included in release tarballs),
|
|
# then try git-describe, then default.
|
|
if test -f version
|
|
then
|
|
VN=$(cat version)
|
|
elif test -d .git
|
|
then
|
|
VN=$(git describe 2>/dev/null) &&
|
|
git update-index -q --refresh
|
|
# test -z "$(git diff-index --name-only HEAD --)" ||
|
|
# VN="$VN-dirty"
|
|
else
|
|
VN="$DEF_VER"
|
|
fi
|
|
|
|
#VN=$(expr "$VN" : v*'\(.*\)')
|
|
|
|
echo "$VN"
|
|
|
|
if test -r $GVF
|
|
then
|
|
VC=$(grep SYSTEM_VERSION $GVF | sed -e 's/^#define SYSTEM_VERSION //')
|
|
VM=$(grep SYSTEM_APP $GVF | sed -e 's/^#define SYSTEM_APP //')
|
|
else
|
|
VC=unset
|
|
fi
|
|
test "\"$VN\"" = "$VC" -a "\"-$APP\"" = "$VM" || {
|
|
echo "#define SYSTEM_VERSION \"$VN\"" >$GVF
|
|
echo "#define SYSTEM_APP \"-$APP\"" >>$GVF
|
|
|
|
}
|
|
|
|
|
|
|