2008-06-22 20:42:07 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $1 file containing the last git-describe output
|
|
|
|
# $2 the file in which to update the version string
|
|
|
|
#
|
|
|
|
# TODO: proper error handling
|
|
|
|
|
2008-06-22 22:15:37 +02:00
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "$0: WARNING: version stamp update failed."
|
|
|
|
#exit 1 # not important enough to stop the build.
|
|
|
|
exit 0
|
2008-06-22 20:42:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
STAMP=`cat "$1" 2> /dev/null`
|
2015-03-07 14:08:39 +01:00
|
|
|
CURRENT=`git describe --dirty 2>/dev/null`
|
2008-06-22 20:42:07 +02:00
|
|
|
|
2008-06-22 22:15:37 +02:00
|
|
|
if [ -z "$STAMP" -o -z "$CURRENT" ]
|
|
|
|
then
|
|
|
|
die
|
2008-06-22 20:42:07 +02:00
|
|
|
fi
|
|
|
|
|
2008-06-22 22:15:37 +02:00
|
|
|
if [ "$STAMP" != "$CURRENT" ]
|
|
|
|
then
|
|
|
|
echo "git version changed: $STAMP -> $CURRENT"
|
|
|
|
sed -e s/$STAMP/$CURRENT/g "$2" 1> "$2.new" || die
|
|
|
|
mv "$2.new" "$2"
|
|
|
|
echo -n "$CURRENT" > "$1"
|
2008-06-22 20:42:07 +02:00
|
|
|
fi
|