On Mon, Jul 26, 2010 at 2:17 AM, Bruno Wolff III <[email protected]> wrote:

> I have attached two patches from bug 582051 that are intended to make
> --skipcopy more useful for testing. One is for functionallity, the other
> expands the documentation of what skipcopy skips a bit better.
>
> As discussed in the bug report I don't like:
>
> +if [ -s $USBMNT/$LIVEOS/$OVERFILE ]; then
>
> and think that it should be:
>
> +if [ "$overlaysizemb" -gt 0 ]; then
>
> This is easier to understand and seems more likely to be correct.
> I am not sure if my comment about my suggestion was misunderstood, but I
> don't see why my suggestion wouldn't work and the one provided would.
> But maybe there is something subtle going on.
>
> Since --skipcopy is for testing I don't think the patch will have much
> impact on normal use.
>
> So I would be inclined to except this patch if modified as I suggest, but
> I'd
> like to get more feedback.


I think the confusion here is due to the dual use of --skipcopy:

1. Testing the livecd-iso-to-disk script (with variations on installation
options, for example), or

2. Repairing boot configuration files on an already-installed LiveUSB image.

For use #2, one would test for the existence of the overlay file on the
target device, rather than the existence of a request for a new overlay
(because $overlaysizemb is set only by the command line option
--overlay-size-mb <size>, which is the way one requests a new, persistent
overlay).

So to include an existing overlay reference on an image needing a new boot
configuration file, one could simply invoke the --skipcopy option---without
needing also to include a, perhaps counterintuitive, request for a new,
persistent overlay.  This, of course, means that the variable $OVERFILE must
be set without the new overlay request (which the attached patch provides).

In the standard installation case, if an overlay was requested, the overlay
file will have just been created with dd before the $OVERFILE test is
performed.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index f4d0855..20886ea 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -418,7 +418,7 @@ fi
 
 # do some basic sanity checks.  
 checkMounted $USBDEV
-if [ -n "$format" ];then
+if [ -z "$skipcopy" -a -n "$format" ]; then
   checkLVM $USBDEV
   # checks for a valid filesystem
   if [ -n "$efi" ];then
@@ -619,26 +619,30 @@ if [ "$isotype" = "installer" ]; then
   sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
 fi
 
-if [ "$overlaysizemb" -gt 0 ]; then
+OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $USBDEV )-$( /sbin/blkid -s UUID -o value $USBDEV )"
+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
 	# vfat can't handle sparse files
 	dd if=/dev/zero of=$USBMNT/$LIVEOS/$OVERFILE count=$overlaysizemb bs=1M
     else
 	dd if=/dev/null of=$USBMNT/$LIVEOS/$OVERFILE count=1 bs=1M seek=$overlaysizemb
     fi
+fi
+
+# include these during --skipcopy boot reconfiguration to support boot file repair
+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
 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