]> err.no Git - linux-2.6/commitdiff
[POWERPC] bootwrapper: Bail from script if any command fails
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 23 Oct 2007 04:27:36 +0000 (14:27 +1000)
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>
Thu, 1 Nov 2007 12:11:11 +0000 (07:11 -0500)
Add the 'set -e' command to the wrapper script so that if any command
fails then the script will automatically exit

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
arch/powerpc/boot/wrapper

index 347639c63936f592329314a95ddeb77b0211830d..5ae48f474dfa133c40d4fd67f91ac0f23d5539f2 100755 (executable)
@@ -21,6 +21,9 @@
 #              (default ./arch/powerpc/boot)
 # -W dir       specify working directory for temporary files (default .)
 
+# Stop execution if any command fails
+set -e
+
 # Allow for verbose output
 if [ "$V" = 1 ]; then
     set -x
@@ -116,7 +119,7 @@ if [ -n "$dts" ]; then
     if [ -z "$dtb" ]; then
        dtb="$platform.dtb"
     fi
-    dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1
+    dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts"
 fi
 
 if [ -z "$kernel" ]; then
@@ -287,23 +290,13 @@ ps3)
 
     rm -f "$object/otheros.bld"
 
-    msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
-        skip=$overlay_dest seek=$system_reset_kernel      \
-        count=$overlay_size bs=1 2>&1)
-
-    if [ $? -ne "0" ]; then
-       echo $msg
-       exit 1
-    fi
+    dd if="$ofile.bin" of="$ofile.bin" conv=notrunc   \
+        skip=$overlay_dest seek=$system_reset_kernel  \
+        count=$overlay_size bs=1
 
-    msg=$(dd if="$ofile.bin" of="$ofile.bin" conv=notrunc \
-        skip=$system_reset_overlay seek=$overlay_dest     \
-        count=$overlay_size bs=1 2>&1)
-
-    if [ $? -ne "0" ]; then
-       echo $msg
-       exit 2
-    fi
+    dd if="$ofile.bin" of="$ofile.bin" conv=notrunc   \
+        skip=$system_reset_overlay seek=$overlay_dest \
+        count=$overlay_size bs=1
 
     gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld"
     ;;