This patch allows livecd-iso-to-disk.sh to detect if the specified .iso
image is an Anaconda DVD installer. If so, it copies it to the USB disk
and configures syslinux to boot it. Anaconda will automatically find
the DVD iso on the USB stick and install from it.
Requires Fedora 11 Preview DVD iso and later.
* This was tested to with Fedora 11 Preview DVD iso, without breaking
standard LiveCD iso install.
* Code is intentionally not "clean" in order to minimize the size of the
git diff to make it easy to visually understand and confirm the changes.
If this patch is acceptable, it will be followed by another patch that
cleans up the code.
Comments?
Warren Togami
wtog...@redhat.com
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 4effb3e..f2873f4 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -275,11 +275,25 @@ if [ $(id -u) != 0 ]; then
exit 1
fi
+detectisotype() {
+if [ -e $CDMNT/LiveOS/squashfs.img ]; then
+isotype=live
+return
+fi
+if [ -e $CDMNT/images/install.img ]; then
+isotype=installer
+return
+fi
+echo "ERROR: $ISO does not appear to be a Live image or DVD installer."
+exitclean
+}
+
cryptedhome=1
keephome=1
homesizemb=0
swapsizemb=0
overlaysizemb=0
+isotype=
LIVEOS=LiveOS
HOMEFILE="home.img"
@@ -436,6 +450,8 @@ mount $mountopts $USBDEV $USBMNT || exitclean
trap exitclean SIGINT SIGTERM
+detectisotype
+
if [ -f "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt 0 ]; then
echo "ERROR: Requested keeping existing /home and specified a size for /home"
echo "Please either don't specify a size or specify --delete-home"
@@ -476,6 +492,7 @@ if [ -n "$skipcompress" ]; then
fi
free=$(df -B1M $USBDEV |tail -n 1 |awk {'print $4;'})
+if [ "$isotype" = "live" ]; then
if [ $(($overlaysizemb + $homesizemb + $livesize + $swapsizemb)) -gt $(($free + $tbd)) ]; then
echo "Unable to fit live image + overlay on available space on USB stick"
echo "Size of live image: $livesize"
@@ -485,8 +502,29 @@ if [ $(($overlaysizemb + $homesizemb + $livesize + $swapsizemb)) -gt $(($free +
echo "Available space: $(($free + $tbd))"
exitclean
fi
+fi
-if [ -z "$skipcopy" ];then
+# Verify available space for DVD installer
+if [ "$isotype" = "installer" ]; then
+ isosize=$(du -s -B 1M $ISO | awk {'print $1;'})
+ installimgsize=$(du -s -B 1M $CDMNT/images/install.img | awk {'print $1;'})
+ tbd=0
+ if [ -e $USBMNT/images/install.img ]; then
+tbd=$(du -s -B 1M $USBMNT/images/install.img | awk {'print $1;'})
+ fi
+ if [ -e $USBMNT/$(basename $ISO) ]; then
+tbd=$(($tbd + $(du -s -B 1M $USBMNT/$(basename $ISO) | awk {'print $1;'})))
+ fi
+ echo "Size of DVD image: $isosize"
+ echo "Size of install.img: $installimgsize"
+ echo "Available space: $(($free + $tbd))"
+ if [ $(($isosize + $installimgsize)) -gt $(($free + $tbd)) ]; then
+echo "ERROR: Unable to fit DVD image + install.img on available space on USB stick"
+exitclean
+ fi
+fi
+
+if [ -z "$skipcopy" ] && [ "$isotype" = "live" ];then
if [ -d $USBMNT/$LIVEOS -a -z "$force" ]; then
echo "Already set up as live image."
if [ -z "$keephome" -a -e $USBMNT/$LIVEOS/$HOMEFILE ]; then
@@ -508,7 +546,8 @@ fi
[ ! -d $USBMNT/$SYSLINUXPATH ] && mkdir -p $USBMNT/$SYSLINUXPATH
[ -n "$efi" -a ! -d $USBMNT/EFI/boot ] && mkdir -p $USBMNT/EFI/boot
-if [ -z "$skipcopy" ];then
+# Live image copy
+if [ "$isotype" = "live" ] && [ -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
@@ -526,6 +565,14 @@ if [ -z "$skipcopy" ];then
fi
fi
+# DVD installer copy
+if [ "$isotype" = "installer" ] && [ -z "$skipcopy" ]; then
+ echo "Copying DVD image to USB stick"
+ mkdir -p $USBMNT/images/
+ cp $CDMNT/images/install.img $USBMNT/images/install.img || exitclean
+ cp $ISO $USBMNT/
+fi
+
cp $CDMNT/isolinux/* $USBMNT/$SYSLINUXPATH
BOOTCONFIG=$USBMNT/$SYSLINUXPATH/isolinux.cfg
# Set this to nothing so sed doesn't care
@@ -543,6 +590,10 @@ echo "Updating boot config file"
sed -i -e "s/CDLABEL=[^ ]*/$USBLABEL/" -e "s/rootfstype=[^ ]*/rootfstype=$USBFS/" $BOOTCONFIG $BOOTCONFIG_EFI
if [ -n "$kernelargs" ]; then sed -i -e "s/liveimg/liveimg ${kernelargs}/" $BOOTCONFIG $BOOTCONFIG_EFI ; fi
if [ "$LIVEOS" != "LiveOS" ]; then sed -i -e "s;liveimg;liveimg live_dir=$LIVEOS;" $BOOTCONFIG $BOOTCONFIG_EFI ; fi
+# DVD Installer
+if [ "$isotype" = "installer" ]; then
+ sed -i -e "s;initrd=initrd.img;initrd=initrd.img repo=hd:$USBLABEL:/;g" $BOOTCONFIG $BOOTCONFIG_EFI
+fi
if [ "$overlaysizemb" -gt 0 ]; then
echo "Initializing persistent overlay file"
--
Fedora-livecd-list mailing list
Fedora-livecd-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-livecd-list