[Fedora-livecd-list] [Patch] Trap copyFile errors
Frederick Grose
fgrose at gmail.com
Fri Dec 17 03:22:49 UTC 2010
>From Bug 663849 <https://bugzilla.redhat.com/show_bug.cgi?id=663849> - copyFile
failures not trapped in livecd-iso-to-disk
Trap copyFile errors
Set -o pipefail is needed with the new strace-based copy function.
And 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..464b5e4 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -21,6 +21,7 @@
export PATH=/sbin:/usr/sbin:$PATH
+set -o pipefail
usage() {
echo "$0 [--timeout <time>] [--totaltimeout <time>] [--format]
[--reset-mbr] [--noverify] [--overlay-size-mb <size>] [--home-size-mb
<size>] [--unencrypted-home] [--skipcopy] [--efi] <isopath> <usbstick
device>"
@@ -694,7 +695,8 @@ if [ "$isotype" = "live" -a -z "$skipcopy" ]; then
[ -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/livecd/attachments/20101216/0a70d33d/attachment.html
More information about the livecd
mailing list