Fix the return code when used with tee.

This commit is contained in:
Chris Johns
2006-08-04 09:48:38 +00:00
parent 5aafd7a263
commit 808db8ea74

View File

@@ -1,3 +1,4 @@
#! /bin/sh
# #
# $Id$ # $Id$
# #
@@ -8,16 +9,19 @@
# Note: This file should be placed in crossrpms. # Note: This file should be placed in crossrpms.
# #
command_line="$0 $*"
terminate() terminate()
{ {
echo "error: $*" >&2 echo "error: $*" >&2
exit 1 exit 1
echo "after"
} }
check() check()
{ {
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
terminate terminate $*
fi fi
} }
@@ -80,11 +84,18 @@ do
shift shift
done done
echo "$command_line" > $log
scripts=$(dirname $0) scripts=$(dirname $0)
$scripts/build-rpms.sh -i $debug $no_run $prefix $source $targets $hosts $version 2>&1 | tee $log $scripts/build-rpms.sh -i $debug $no_run $prefix $source $targets $hosts $version 2>&1 | tee -a $log
check "Making the RPM files." if [ ${PIPESTATUS[0]} -ne 0 ]; then
terminate "Making the RPM files."
fi
$scripts/build-exes.sh $debug $no_run $prefix $targets $relocation 2>&1 | tee -a $log $scripts/build-exes.sh $debug $no_run $prefix $targets $relocation 2>&1 | tee -a $log
check "Making the executable files." if [ ${PIPESTATUS[0]} -ne 0 ]; then
terminate "Making the executable files."
fi
exit 0