<div class="gmail_quote">On Thu, Dec 16, 2010 at 8:22 PM, Frederick Grose <span dir="ltr"><<a href="mailto:fgrose@gmail.com">fgrose@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font face="'courier new', monospace">From <a href="https://bugzilla.redhat.com/show_bug.cgi?id=663849" style="color:rgb(0, 102, 204);text-decoration:none" target="_blank">Bug 663849</a> -<span> <span>copyFile failures not trapped in livecd-iso-to-disk</span></span></font></blockquote>
<div><br></div><div>[Patch v2]</div><div><span class="Apple-style-span" style="font-family: 'DejaVu Sans', 'Liberation Sans', sans-serif; "><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
set -o pipefail reverses the logic of
if ! syslinux 2>&1 | grep -qe -d; then
...
in checkSyslinuxVersion()
so delay setting this option until just before it's needed for image copying.</pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
<br></pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">Testing of more scenarios is requested...</pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; ">
--Fred</pre><pre class="bz_comment_text" id="comment_text_4" style="font-size: medium; font-family: monospace; white-space: pre-wrap; width: 50em; "><br></pre></span></div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "><pre style="word-wrap: break-word; white-space: pre-wrap; ">
Trap copyFile errors
'Set -o pipefail' is needed with the new starce-based copy function.
Also, keep || clauses inprocess, so that an exit command applies to
the main script and not just a subshell.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 51abc0c..dfabed7 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -688,13 +688,15 @@ fi
[ -n "$efi" -a ! -d $USBMNT/EFI/boot ] && mkdir -p $USBMNT/EFI/boot
# Live image copy
+set -o pipefail
if [ "$isotype" = "live" -a -z "$skipcopy" ]; then
echo "Copying live image to USB stick"
[ ! -d $USBMNT/$LIVEOS ] && mkdir $USBMNT/$LIVEOS
[ -n "$keephome" -a -f "$USBMNT/$HOMEFILE" ] && mv $USBMNT/$HOMEFILE $USBMNT/$LIVEOS/$HOMEFILE
if [ -n "$skipcompress" -a -f $CDMNT/LiveOS/squashfs.img ]; then
mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT || exitclean
- copyFile $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || (umount $CDMNT ; exitclean)
+ copyFile $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || {
+ umount $CDMNT ; exitclean ; }
umount $CDMNT
elif [ -f $CDMNT/LiveOS/squashfs.img ]; then </pre></span><div><span class="Apple-style-span" style="font-family: monospace; white-space: pre-wrap; font-size: medium; "> copyFile $CDMNT/LiveOS/squashfs.img $USBMNT/$LIVEOS/squashfs.img || exitclean</span> </div>
</div>