Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 41 lines (32 sloc) 658 Bytes
#!/bin/sh
# From git
PVF=POWAUR-VERSION-FILE
DEF_VER=v0.1.6
LF='
'
# First see if there is a version file, then try git-describe, then default
if test -f version; then
VN=$(cat version) || VN="$DEF_VER"
elif test -d .git &&
VN=$(git describe --match "v[0-9]*" --abbrev=4 2>/dev/null) &&
case "$VN" in
*$LF*)
(exit 1)
;;
esac
then
VN=$(echo "$VN" | sed -e's/-/./g')
else
VN="$DEF_VER"
fi
# Check whether we need to rewrite to PVF
VN=$(expr "$VN" : v*'\(.*\)')
if test -r $PVF; then
VC=$(sed -e 's/^POWAUR_VERSION = //' <$PVF)
else
VC=unset
fi
test "$VN" = "$VC" || {
echo >&2 "POWAUR_VERSION = $VN"
echo "POWAUR_VERSION = $VN" > $PVF
}