build: fix bashisms
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7448914304
commit
41b4214d18
|
@ -5,22 +5,25 @@
|
|||
#
|
||||
# TODO: proper error handling
|
||||
|
||||
die() {
|
||||
echo "$0: WARNING: version stamp update failed."
|
||||
#exit 1 # not important enough to stop the build.
|
||||
exit 0
|
||||
die()
|
||||
{
|
||||
echo "$0: WARNING: version stamp update failed."
|
||||
#exit 1 # not important enough to stop the build.
|
||||
exit 0
|
||||
}
|
||||
|
||||
STAMP=`cat "$1" 2> /dev/null`
|
||||
CURRENT=`git-describe 2>/dev/null`
|
||||
|
||||
if [[ -z "$STAMP" || -z "$CURRENT" ]]; then
|
||||
die
|
||||
if [ -z "$STAMP" -o -z "$CURRENT" ]
|
||||
then
|
||||
die
|
||||
fi
|
||||
|
||||
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"
|
||||
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"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue