build: fix bashisms

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-22 22:15:37 +02:00
parent 7448914304
commit 41b4214d18
1 changed files with 14 additions and 11 deletions

View File

@ -5,22 +5,25 @@
# #
# TODO: proper error handling # TODO: proper error handling
die() { die()
echo "$0: WARNING: version stamp update failed." {
#exit 1 # not important enough to stop the build. echo "$0: WARNING: version stamp update failed."
exit 0 #exit 1 # not important enough to stop the build.
exit 0
} }
STAMP=`cat "$1" 2> /dev/null` STAMP=`cat "$1" 2> /dev/null`
CURRENT=`git-describe 2>/dev/null` CURRENT=`git-describe 2>/dev/null`
if [[ -z "$STAMP" || -z "$CURRENT" ]]; then if [ -z "$STAMP" -o -z "$CURRENT" ]
die then
die
fi fi
if [ "$STAMP" != "$CURRENT" ]; then if [ "$STAMP" != "$CURRENT" ]
echo "git version changed: $STAMP -> $CURRENT" then
sed -e s/$STAMP/$CURRENT/g "$2" 1> "$2.new" || die echo "git version changed: $STAMP -> $CURRENT"
mv "$2.new" "$2" sed -e s/$STAMP/$CURRENT/g "$2" 1> "$2.new" || die
echo -n "$CURRENT" > "$1" mv "$2.new" "$2"
echo -n "$CURRENT" > "$1"
fi fi