tag: Improve tag property::index support (FS#1229)
[awesome.git] / build-utils / git-version-stamp.sh
blobfa1299b052fe40123d3ddeaacd23e6e7abaffb63
1 #!/bin/sh
3 # $1 file containing the last git-describe output
4 # $2 the file in which to update the version string
6 # TODO: proper error handling
8 die()
10 echo "$0: WARNING: version stamp update failed."
11 #exit 1 # not important enough to stop the build.
12 exit 0
15 STAMP=`cat "$1" 2> /dev/null`
16 CURRENT=`git describe 2>/dev/null`
18 if [ -z "$STAMP" -o -z "$CURRENT" ]
19 then
20 die
23 if [ "$STAMP" != "$CURRENT" ]
24 then
25 echo "git version changed: $STAMP -> $CURRENT"
26 sed -e s/$STAMP/$CURRENT/g "$2" 1> "$2.new" || die
27 mv "$2.new" "$2"
28 echo -n "$CURRENT" > "$1"