The --skipcopy option in livecd-iso-to-disk was implemented to aid testing
and boot configuration file recovery (see
http://article.gmane.org/gmane.linux.redhat.fedora.livecd/2682).

I've found that it will overwrite both an existing persistent overlay and
home.img, if they exist.  This is unintentional destructive behavior.

While it may seem that one wouldn't ask for a new overlay or home folder
AND skipcopy--during the testing of scripts, this is a reasonable scenario.

I've filed a bug, https://bugzilla.redhat.com/show_bug.cgi?id=582051,
containing the attached skipcopy.patch.

Please review and advise me on how to proceed.

This is a piece of a project to enhance the livecd-iso-to-disk script for
the Sugar on a Stick customization kit project, but it has more general
benefits.

Again, please see https://bugzilla.redhat.com/show_bug.cgi?id=448030 and
advise.

I'm planning now to submit smaller change patches to make review easier.

          --Fred
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 3a4726d..496b6c0 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -606,7 +606,7 @@ if [ "$isotype" = "installer" ]; then
   sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
 fi
 
-if [ "$overlaysizemb" -gt 0 ]; then
+if [ -z "$skipcopy" -a "$overlaysizemb" -gt 0 ]; then
     echo "Initializing persistent overlay file"
     OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $USBDEV )-$( /sbin/blkid -s UUID -o value $USBDEV )"
     if [ "$USBFS" = "vfat" ]; then
@@ -615,17 +615,21 @@ if [ "$overlaysizemb" -gt 0 ]; then
     else
 	dd if=/dev/null of=$USBMNT/$LIVEOS/$OVERFILE count=1 bs=1M seek=$overlaysizemb
     fi
+fi
+
+# include these with --skipcopy boot reconfiguration
+if [ -s $USBMNT/$LIVEOS/$OVERFILE ]; then
     sed -i -e "s/liveimg/liveimg overlay=${USBLABEL}/" $BOOTCONFIG $BOOTCONFIG_EFI
-    sed -i -e "s/\ ro\ /\ rw\ /" $BOOTCONFIG  $BOOTCONFIG_EFI
+    sed -i -e "s/\ ro\ /\ rw\ /" $BOOTCONFIG $BOOTCONFIG_EFI
 fi
 
-if [ "$swapsizemb" -gt 0 ]; then
+if [ -z "$skipcopy" -a "$swapsizemb" -gt 0 ]; then
     echo "Initializing swap file"
     dd if=/dev/zero of=$USBMNT/$LIVEOS/swap.img count=$swapsizemb bs=1M
     mkswap -f $USBMNT/$LIVEOS/swap.img
 fi
 
-if [ "$homesizemb" -gt 0 ]; then
+if [ -z "$skipcopy" -a "$homesizemb" -gt 0 ]; then
     echo "Initializing persistent /home"
     homesource=/dev/zero
     [ -n "$cryptedhome" ] && homesource=/dev/urandom
--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to