git-update: Fix error return value and make the script exit on errors

Newer versions of BASH (4.x?) seem to dislike using -1 for a return. Even
though it's documented as being signed, BASH complains about it, so use
255 instead.
This commit is contained in:
Robert Swain 2010-03-12 13:33:00 +00:00
parent 374b4b343f
commit cc05668e9d

View file

@ -26,6 +26,7 @@ tmp=$tmp/git-update.$(date +%Y%m%d-%H%M-).$RANDOM.$RANDOM.$RANDOM.$$
ERROR_LOG="$tmp/failures.log" ERROR_LOG="$tmp/failures.log"
touch $ERROR_LOG touch $ERROR_LOG
ERROR_RETURN=255
for m in $CORE $MODULES; do for m in $CORE $MODULES; do
if test -d $m; then if test -d $m; then
@ -70,7 +71,7 @@ build()
then then
echo "$1: autoregen.sh [$tmp/$1-regen.log]" >> $ERROR_LOG echo "$1: autoregen.sh [$tmp/$1-regen.log]" >> $ERROR_LOG
cd .. cd ..
return -1 return $ERROR_RETURN
fi fi
echo "+ $1: autoregen.sh done" echo "+ $1: autoregen.sh done"
fi fi
@ -81,7 +82,7 @@ build()
then then
echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG
cd .. cd ..
return -1 return $ERROR_RETURN
fi fi
echo "+ $1: make done" echo "+ $1: make done"
@ -109,13 +110,14 @@ if test -e $ERROR_LOG; then
else else
rm -rf "$tmp" rm -rf "$tmp"
fi fi
exit
} }
# build core and base plugins sequentially # build core and base plugins sequentially
# exit if build fails (excluding checks) # exit if build fails (excluding checks)
for m in $CORE; do for m in $CORE; do
build $m build $m
if [ $? == -1 ]; then if [ $? -eq $ERROR_RETURN ]; then
beach beach
fi fi
done done