On Thu, Dec 16, 2010 at 8:22 PM, Frederick Grose <fgrose(a)gmail.com> wrote:
From Bug 663849
<
https://bugzilla.redhat.com/show_bug.cgi?id=663849> - copyFile
failures not trapped in livecd-iso-to-disk
[Patch v2]
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.
Testing of more scenarios is requested...
--Fred
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
copyFile $CDMNT/LiveOS/squashfs.img $USBMNT/$LIVEOS/squashfs.img ||
exitclean