LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: paulus@samba.org, linuxppc-dev@ozlabs.org
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 2/4] bootwrapper: Bail from script if any command fails
Date: Mon, 22 Oct 2007 22:27:36 -0600	[thread overview]
Message-ID: <20071023042736.30309.38936.stgit@trillian.cg.shawcable.net> (raw)
In-Reply-To: <20071023042353.30309.93118.stgit@trillian.cg.shawcable.net>

From: Grant Likely <grant.likely@secretlab.ca>

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>
---

 arch/powerpc/boot/wrapper |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 347639c..5ae48f4 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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"
     ;;

  parent reply	other threads:[~2007-10-23  4:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-23  4:27 [PATCH 0/4] Misc patches for the 2.6.24 merge window Grant Likely
2007-10-23  4:27 ` [PATCH 1/4] bootwrapper: Allow wrapper script to execute verbosely Grant Likely
2007-10-23  4:27 ` Grant Likely [this message]
2007-10-23  4:27 ` [PATCH 3/4] Device tree bindings for Xilinx devices Grant Likely
2007-10-23 12:36   ` Josh Boyer
2007-10-23  4:27 ` [PATCH 4/4] Uartlite: speed up console output Grant Likely
2007-10-31 14:45   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071023042736.30309.38936.stgit@trillian.cg.shawcable.net \
    --to=grant.likely@secretlab.ca \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox