trap EXIT
test -z "$1" && set 0
rm -f $BUILD_ROOT/exit
- BS=$1
- if [ $BS -eq 1 -a -x /bin/df ]; then
- # okay, it failed, but maybe because of me ? (no disk space)
+ if test "$1" -eq 1 -a -x /bin/df ; then
+ # okay, it failed, but maybe because disk space?
if df $BUILD_ROOT 2>/dev/null | grep -q "100%"; then
- BS=3
+ set 3
fi
fi
if test -n "$RUNNING_IN_VM" ; then
cd /
if test -n "$VM_SWAP" -a -e "$VM_SWAP" ; then
swapoff "$VM_SWAP" 2>/dev/null
- echo -n "BUILDSTATUS$BS" >"$VM_SWAP"
+ echo -n "BUILDSTATUS$1" >"$VM_SWAP"
fi
exec >&0 2>&0 # so that the logging tee finishes
sleep 1 # wait till tee terminates
[ -n "$VM_IMAGE" ] && umount $BUILD_ROOT 2>/dev/null || true
fi
# echo "pid $$ exit $1"
- exit $BS
+ exit $1
}
fail_exit()