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,7 +5,8 @@
# #
# TODO: proper error handling # TODO: proper error handling
die() { die()
{
echo "$0: WARNING: version stamp update failed." echo "$0: WARNING: version stamp update failed."
#exit 1 # not important enough to stop the build. #exit 1 # not important enough to stop the build.
exit 0 exit 0
@ -14,11 +15,13 @@ die() {
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" ]
then
die die
fi fi
if [ "$STAMP" != "$CURRENT" ]; then if [ "$STAMP" != "$CURRENT" ]
then
echo "git version changed: $STAMP -> $CURRENT" echo "git version changed: $STAMP -> $CURRENT"
sed -e s/$STAMP/$CURRENT/g "$2" 1> "$2.new" || die sed -e s/$STAMP/$CURRENT/g "$2" 1> "$2.new" || die
mv "$2.new" "$2" mv "$2.new" "$2"