[Fedora-livecd-list] [SoaS] Call for Testing: Duplicating SoaS via CMD

Frederick Grose fgrose at gmail.com
Mon Mar 29 19:58:31 UTC 2010


On Sun, Mar 28, 2010 at 12:55 PM, Sebastian Dziallas <sebastian at when.com> wrote:
>
> Hi all,
>
> it would be great if somebody could give this standard procedure a try
> and confirm whether it works or not, so that we can react appropriately
> upon a ticket. You'll need two USB keys for this.
>
> (1) use Fedora's LiveUSB Creator to prepare the first key with SoaS
>
> (2) boot the first key and apply some changes as in:
>
>        (a) change the language
>        (b) download a number of activities
>
> (3) plug in the second USB key and determine its mount point
>
> (4) run as root on the first key: yum install livecd-tools (might or
> might not be already present, depending on which SoaS version you use)
>
> (5) execute the following command from the terminal on the first key:
>
>        livecd-iso-to-disk --overlay-size-mb 300 /dev/sr0 /dev/sdc1
>
> (in which case /dev/sdc1 would be the mount point of the second key)
>
> Does this [ ] WORK or [ ] FAIL? Please let us know!
>
> Thanks,
> --Sebastian
> _______________________________________________
> SoaS mailing list
> SoaS at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/soas

I've tested a different approach with some success for customizing and
replicating a LiveUSB image:

1. Downloaded http://alt.fedoraproject.org/pub/alt/nightly-composes/soas/soas-i386-20100327.19.iso

2. In Fedora13 (32-bit), ran this script:
    modified_livecd-iso-to-disk --overlay-size-mb 400 --delete-home
--extra-kernel-args selinux=0 /path_to_soas-i386-20100327.19.iso
/dev/sdb1

3. Booted the LiveUSB device1 and made a few changes.

4. Mounted a second USB device2 on an extended USB port on my monitor,
confirmed its partition name as /dev/sdc1, then unmounted it.

5. Mounted my Fedora13 partition (/dev/sda1) onto the device1 LiveUSB
image, and ran this script in the Sugar Terminal:
   /mnt/F13/home/account/.../ modified_livecd-iso-to-disk --noverify
--delete-home --extra-kernel-args selinux=0 --copy-overlay /dev/live
/dev/sdc1

6. Shutdown and swapped USB devices in order to boot device2 from the
motherboard USB port.

7. Confirmed that I had a replicated image with the copied overlay file.

8. More testing needed.

The modified script is attached.

Here is the diff from the current tools_livecd-iso-to-disk:

--- tools_livecd-iso-to-disk.sh
+++ modified_livecd-iso-to-disk
@@ -308,6 +308,9 @@
   overlaysizemb=$2
   shift
   ;;
+ --copy-overlay)
+    copyoverlay=1
+    ;;
--home-size-mb)
   checkint $2
            homesizemb=$2
@@ -481,6 +484,13 @@
  tbd=0
fi
livesize=$(du -s -B 1M $check | awk {'print $1;'})
+if [ ! -n "$copyoverlay" ]; then
+  OVERLAYFILE="overlay-$( /sbin/blkid -s LABEL -o value $ISO )-$(
/sbin/blkid -s UUID -o value $ISO )"
+  if [ -f $check/$OVERLAYFILE ]; then
+     copyoverlaysize=$(du -s -B 1M $check/$OVERLAYFILE | awk {'print $1;'})
+     livesize=$(($livesize - $copyoverlaysize))
+  fi
+fi
if [ -n "$skipcompress" ]; then
    if [ -e $CDMNT/LiveOS/squashfs.img ]; then
if mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT; then
@@ -572,8 +582,16 @@
  if [ -f $CDMNT/LiveOS/osmin.img ]; then
      cp $CDMNT/LiveOS/osmin.img $USBMNT/$LIVEOS/osmin.img || exitclean
  fi
+  if [ -n "$copyoverlay" ]; then
+      OVERLAYFILE="overlay-$( /sbin/blkid -s LABEL -o value $ISO )-$(
/sbin/blkid -s UUID -o value $ISO )"
+      cp $CDMNT/LiveOS/$OVERLAYFILE $USBMNT/$LIVEOS/$OVERLAYFILE || exitclean
+  fi
fi

+# copy this installer script to enable the new installation to
replicate the image
+SCRIPT=$(readlink -f $0)
+cp -f $SCRIPT $USBMNT/$LIVEOS/livecd-iso-to-disk
+
# DVD installer copy
if [ "$isotype" = "installer" ] && [ -z "$skipcopy" ]; then
      echo "Copying DVD image to USB stick"
@@ -582,7 +600,18 @@
      cp $ISO $USBMNT/
fi

-cp $CDMNT/isolinux/* $USBMNT/$SYSLINUXPATH
+# adjust syslinux sources for replication of installed images between
filesystem types
+if [ -d $CDMNT/isolinux/ ]; then
+    cp $CDMNT/isolinux/* $USBMNT/$SYSLINUXPATH
+elif [ -d $CDMNT/syslinux/ ]; then
+    cp $CDMNT/syslinux/* $USBMNT/$SYSLINUXPATH
+    if [ -f $CDMNT/syslinux/extlinux.conf ]; then
+        mv $USBMNT/$SYSLINUXPATH/extlinux.conf
$USBMNT/$SYSLINUXPATH/isolinux.cfg
+    elif [ -f $CDMNT/syslinux/syslinux.cfg ]; then
+        mv $USBMNT/$SYSLINUXPATH/syslinux.cfg
$USBMNT/$SYSLINUXPATH/isolinux.cfg
+    fi
+fi
+
BOOTCONFIG=$USBMNT/$SYSLINUXPATH/isolinux.cfg
# Set this to nothing so sed doesn't care
BOOTCONFIG_EFI=
@@ -594,6 +623,9 @@
  rm -f $USBMNT/EFI/boot/grub.conf
fi

+# restore boot config file to base state before updating
+sed -i -e "s/root=[^ ]*/root=CDLABEL=name/" -e "s/liveimg .*
quiet/liveimg quiet/" $BOOTCONFIG $BOOTCONFIG_EFI
+
echo "Updating boot config file"
# adjust label and fstype
sed -i -e "s/CDLABEL=[^ ]*/$USBLABEL/" -e "s/rootfstype=[^
]*/rootfstype=$USBFS/" -e "s/LABEL=[^ ]*/$USBLABEL/" $BOOTCONFIG
$BOOTCONFIG_EFI
@@ -617,6 +649,11 @@
    fi
    sed -i -e "s/liveimg/liveimg overlay=${USBLABEL}/" $BOOTCONFIG
$BOOTCONFIG_EFI
    sed -i -e "s/\ ro\ /\ rw\ /" $BOOTCONFIG  $BOOTCONFIG_EFI
+elif [ -n "$copyoverlay" ]; then
+    OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $USBDEV )-$(
/sbin/blkid -s UUID -o value $USBDEV )"
+    mv $USBMNT/$LIVEOS/$OVERLAYFILE $USBMNT/$LIVEOS/$OVERFILE
+    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

*********************End of diff***************************

Notes:

The script changes deal with the different location and names
(syslinux.cfg/extlinux.conf/isolinux.cfg) used by the syslinux
convention that would confuse an installation from one LiveUSB
filesystem type to another, for example, vfat to ext23.
(I'm not familiar with the sources for the configuration files, so
there may be some better way to address this.)

This script allows one to use the optional installation parameters of
livecd-iso-to-disk to customize the new installation structure.  I
have examined or tested all the possible code paths, so close
examination and testing is needed before it could be accepted
upstream.

Note, there is a --skipcompress option that might be of interest to
those who would rather have a full ext23 embedded on the LiveUSB.  The
relavent code is here:
  if [ -n "$skipcompress" -a -f $CDMNT/LiveOS/squashfs.img ]; then
      mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT || exitclean
      cp $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img ||
(umount $CDMNT ; exitclean)
      umount $CDMNT
  elif [ -f $CDMNT/LiveOS/squashfs.img ]; then
      cp $CDMNT/LiveOS/squashfs.img $USBMNT/$LIVEOS/squashfs.img || exitclean
  elif [ -f $CDMNT/LiveOS/ext3fs.img ]; then
      cp $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || exitclean
  fi

More work is needed to protect the
/home/liveuser/.sugar/default/owner.key files from the copy.

Hope this helps advance the easy customization and replication of
LiveUSB images.

          --Fred
-------------- next part --------------
A non-text attachment was scrubbed...
Name: modified_livecd-iso-to-disk
Type: application/octet-stream
Size: 24836 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/livecd/attachments/20100329/9b1444ee/attachment.obj 


More information about the livecd mailing list