tools/livecd-iso-to-disk.sh | 132 +++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 69 deletions(-)
New commits: commit 3db0a1cc2cbd218673cb9174e83fcfb059c1a59f Author: Jeremy Katz <ka...@redhat.com> Date: Fri Mar 6 15:58:27 2009 -0500 Basic support for multi-image mode Multi-image mode doesn't install a boot loader, so you have to set it up by hand for now which is left as an exercise for the reader diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index def083b..c803bc7 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -245,6 +245,8 @@ checkSyslinuxVersion() { fi if ! syslinux 2>&1 | grep -qe -d; then SYSLINUXPATH="" + elif [ -n "$multi" ]; then + SYSLINUXPATH="$LIVEOS/syslinux" else SYSLINUXPATH="syslinux" fi @@ -346,7 +348,11 @@ while [ $# -gt 2 ]; do LIVEOS=$2 shift ;; + --multi) + multi=1 + ;; *) + echo "invalid arg -- $1" usage ;; esac @@ -637,28 +643,33 @@ EOF fi -echo "Installing boot loader" -if [ -n "$efi" ]; then +if [ -z "$multi" ]; then + echo "Installing boot loader" + if [ -n "$efi" ]; then # replace the ia32 hack if [ -f "$USBMNT/EFI/boot/boot.conf" ]; then cp -f $USBMNT/EFI/boot/bootia32.conf $USBMNT/EFI/boot/boot.conf ; fi -fi + fi -if [ "$USBFS" = "vfat" -o "$USBFS" = "msdos" ]; then + if [ "$USBFS" = "vfat" -o "$USBFS" = "msdos" ]; then # syslinux expects the config to be named syslinux.cfg # and has to run with the file system unmounted mv $USBMNT/$SYSLINUXPATH/isolinux.cfg $USBMNT/$SYSLINUXPATH/syslinux.cfg cleanup if [ -n "$SYSLINUXPATH" ]; then - syslinux -d $SYSLINUXPATH $USBDEV + syslinux -d $SYSLINUXPATH $USBDEV else - syslinux $USBDEV + syslinux $USBDEV fi -elif [ "$USBFS" = "ext2" -o "$USBFS" = "ext3" ]; then + elif [ "$USBFS" = "ext2" -o "$USBFS" = "ext3" ]; then # extlinux expects the config to be named extlinux.conf # and has to be run with the file system mounted mv $USBMNT/$SYSLINUXPATH/isolinux.cfg $USBMNT/$SYSLINUXPATH/extlinux.conf extlinux -i $USBMNT/$SYSLINUXPATH cleanup + fi +else + cleanup + echo "Multi-image mode selected; not setting up bootloader" fi echo "USB stick set up as live image!" commit 96e874e2893f2f73348d19037a08b51ee72651d2 Author: Jeremy Katz <ka...@redhat.com> Date: Fri Mar 6 14:56:12 2009 -0500 More generally, this is EFI support, not just Intel Macs diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index b7677f0..def083b 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -68,8 +68,8 @@ resetMBR() { return fi getdisk $1 - # if mactel, we need to use the hybrid MBR - if [ -n "$mactel" ];then + # if efi, we need to use the hybrid MBR + if [ -n "$efi" ];then if [ -f /usr/lib/syslinux/gptmbr.bin ]; then gptmbr='/usr/lib/syslinux/gptmbr.bin' elif [ -f /usr/share/syslinux/gptmbr.bin ]; then @@ -313,8 +313,8 @@ while [ $# -gt 2 ]; do --reset-mbr|--resetmbr) resetmbr=1 ;; - --mactel) - mactel=1 + --efi|--mactel) + efi=1 ;; --format) format=1 @@ -384,19 +384,19 @@ fi checkMounted $USBDEV if [ -n "$format" ];then # checks for a valid filesystem - if [ -n "$mactel" ];then + if [ -n "$efi" ];then createGPTLayout $USBDEV else createMSDOSLayout $USBDEV fi fi checkFilesystem $USBDEV -if [ -n "$mactel" ]; then +if [ -n "$efi" ]; then checkGPT $USBDEV fi checkSyslinuxVersion # Because we can't set boot flag for EFI Protective on msdos partition tables -[ -z "$mactel" ] && checkPartActive $USBDEV +[ -z "$efi" ] && checkPartActive $USBDEV [ -n "$resetmbr" ] && resetMBR $USBDEV checkMBR $USBDEV @@ -436,7 +436,7 @@ if [ -f "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt 0 ]; exitclean fi -if [ -n "$mactel" -a ! -d $CDMNT/EFI/boot ]; then +if [ -n "$efi" -a ! -d $CDMNT/EFI/boot ]; then echo "ERROR: This live image does not support EFI booting" exitclean fi @@ -492,7 +492,7 @@ fi # Bootloader is always reconfigured, so keep these out of the if skipcopy stuff. [ ! -d $USBMNT/$SYSLINUXPATH ] && mkdir -p $USBMNT/$SYSLINUXPATH -[ -n "$mactel" -a ! -d $USBMNT/EFI/boot ] && mkdir -p $USBMNT/EFI/boot +[ -n "$efi" -a ! -d $USBMNT/EFI/boot ] && mkdir -p $USBMNT/EFI/boot if [ -z "$skipcopy" ];then echo "Copying live image to USB stick" @@ -516,7 +516,7 @@ cp $CDMNT/isolinux/* $USBMNT/$SYSLINUXPATH BOOTCONFIG=$USBMNT/$SYSLINUXPATH/isolinux.cfg # Set this to nothing so sed doesn't care BOOTCONFIG_EFI= -if [ -n "$mactel" ];then +if [ -n "$efi" ];then cp $CDMNT/EFI/boot/* $USBMNT/EFI/boot # this is a little ugly, but it gets the "interesting" named config file @@ -638,7 +638,7 @@ EOF fi echo "Installing boot loader" -if [ -n "$mactel" ]; then +if [ -n "$efi" ]; then # replace the ia32 hack if [ -f "$USBMNT/EFI/boot/boot.conf" ]; then cp -f $USBMNT/EFI/boot/bootia32.conf $USBMNT/EFI/boot/boot.conf ; fi fi commit 5aa56a03e6d75d439d06a65635c0c394106c0e60 Author: Jeremy Katz <ka...@redhat.com> Date: Fri Mar 6 14:54:43 2009 -0500 Stop supporting making our own EFI-able images Fedora 10 images supported EFI boot and Fedora 11 will. Earlier releases don't really have all of the needed bits to make this work well diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index d816533..b7677f0 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -436,6 +436,11 @@ if [ -f "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt 0 ]; exitclean fi +if [ -n "$mactel" -a ! -d $CDMNT/EFI/boot ]; then + echo "ERROR: This live image does not support EFI booting" + exitclean +fi + # let's try to make sure there's enough room on the stick if [ -d $CDMNT/LiveOS ]; then check=$CDMNT/LiveOS @@ -512,35 +517,7 @@ BOOTCONFIG=$USBMNT/$SYSLINUXPATH/isolinux.cfg # Set this to nothing so sed doesn't care BOOTCONFIG_EFI= if [ -n "$mactel" ];then - if [ -d $CDMNT/EFI/boot ]; then - cp $CDMNT/EFI/boot/* $USBMNT/EFI/boot - else - # whee! this image wasn't made with grub.efi bits. so we get to create - # them here. isn't life grand? - cp $CDMNT/isolinux/* $USBMNT/EFI/boot - mount -o loop,ro -t squashfs $CDMNT/$LIVEOS/squashfs.img $CDMNT - mount -o loop,ro -t ext3 $CDMNT/$LIVEOS/ext3fs.img $CDMNT - cp $CDMNT/boot/efi/EFI/redhat/grub.efi $USBMNT/EFI/boot/boot.efi - cp $CDMNT/boot/grub/splash.xpm.gz $USBMNT/EFI/boot/splash.xpm.gz - if [ -d $CDMNT/lib64 ]; then efiarch="x64" ; else efiarch="ia32"; fi - umount $CDMNT - umount $CDMNT - - # magic config... - cat > $USBMNT/EFI/boot/boot.conf <<EOF -default=0 -splashimage=/EFI/boot/splash.xpm.gz -timeout 10 -hiddenmenu - -title Live - kernel /EFI/boot/vmlinuz0 root=CDLABEL=live rootfstype=iso9660 ro quiet liveimg - initrd /EFI/boot/initrd0.img -EOF - - cp $USBMNT/EFI/boot/boot.conf $USBMNT/EFI/boot/boot${efiarch}.conf - cp $USBMNT/EFI/boot/boot.efi $USBMNT/EFI/boot/boot${efiarch}.efi - fi + cp $CDMNT/EFI/boot/* $USBMNT/EFI/boot # this is a little ugly, but it gets the "interesting" named config file BOOTCONFIG_EFI=$USBMNT/EFI/boot/boot?*.conf commit 95393d0e4be6b5599f54baaf727c17bce09fb3f7 Author: Jeremy Katz <ka...@redhat.com> Date: Fri Mar 6 16:23:03 2009 -0500 Simple parameterization to replace all LiveOS instances with $LIVEOS To start supporting multiple live images, we need to handle switching out. Note there are still a few things which are always LiveOS (eg, CDs created by livecd-creator) diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index 7ab1d86..d816533 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -278,6 +278,7 @@ keephome=1 homesizemb=0 swapsizemb=0 overlaysizemb=0 +LIVEOS=LiveOS HOMEFILE="home.img" while [ $# -gt 2 ]; do @@ -341,6 +342,10 @@ while [ $# -gt 2 ]; do --force) force=1 ;; + --livedir) + LIVEOS=$2 + shift + ;; *) usage ;; @@ -425,7 +430,7 @@ mount $mountopts $USBDEV $USBMNT || exitclean trap exitclean SIGINT SIGTERM -if [ -f "$USBMNT/LiveOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt 0 ]; then +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" exitclean @@ -437,9 +442,9 @@ if [ -d $CDMNT/LiveOS ]; then else check=$CDMNT fi -if [ -d $USBMNT/LiveOS ]; then - tbd=$(du -s -B 1M $USBMNT/LiveOS | awk {'print $1;'}) - [ -f $USBMNT/LiveOS/$HOMEFILE ] && homesz=$(du -s -B 1M $USBMNT/LiveOS/$HOMEFILE | awk {'print $1;'}) +if [ -d $USBMNT/$LIVEOS ]; then + tbd=$(du -s -B 1M $USBMNT/$LIVEOS | awk {'print $1;'}) + [ -f $USBMNT/$LIVEOS/$HOMEFILE ] && homesz=$(du -s -B 1M $USBMNT/$LIVEOS/$HOMEFILE | awk {'print $1;'}) [ -n "$homesz" -a -n "$keephome" ] && tbd=$(($tbd - $homesz)) else tbd=0 @@ -463,9 +468,9 @@ if [ $(($overlaysizemb + $homesizemb + $livesize + $swapsizemb)) -gt $(($free + fi if [ -z "$skipcopy" ];then - if [ -d $USBMNT/LiveOS -a -z "$force" ]; 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 + if [ -z "$keephome" -a -e $USBMNT/$LIVEOS/$HOMEFILE ]; then echo "WARNING: Persistent /home will be deleted!!!" echo "Press Enter to continue or ctrl-c to abort" read @@ -473,10 +478,10 @@ if [ -z "$skipcopy" ];then echo "Deleting old OS in fifteen seconds..." sleep 15 - [ -e "$USBMNT/LiveOS/$HOMEFILE" -a -n "$keephome" ] && mv $USBMNT/LiveOS/$HOMEFILE $USBMNT/$HOMEFILE + [ -e "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" ] && mv $USBMNT/$LIVEOS/$HOMEFILE $USBMNT/$HOMEFILE fi - rm -rf $USBMNT/LiveOS + rm -rf $USBMNT/$LIVEOS fi fi @@ -486,19 +491,19 @@ fi if [ -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 + [ ! -d $USBMNT/$LIVEOS ] && mkdir $USBMNT/$LIVEOS + [ -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 - cp $CDMNT/LiveOS/ext3fs.img $USBMNT/LiveOS/ext3fs.img || (umount $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 + 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 + cp $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || exitclean fi if [ -f $CDMNT/LiveOS/osmin.img ]; then - cp $CDMNT/LiveOS/osmin.img $USBMNT/LiveOS/osmin.img || exitclean + cp $CDMNT/LiveOS/osmin.img $USBMNT/$LIVEOS/osmin.img || exitclean fi fi @@ -513,8 +518,8 @@ if [ -n "$mactel" ];then # whee! this image wasn't made with grub.efi bits. so we get to create # them here. isn't life grand? cp $CDMNT/isolinux/* $USBMNT/EFI/boot - mount -o loop,ro -t squashfs $CDMNT/LiveOS/squashfs.img $CDMNT - mount -o loop,ro -t ext3 $CDMNT/LiveOS/ext3fs.img $CDMNT + mount -o loop,ro -t squashfs $CDMNT/$LIVEOS/squashfs.img $CDMNT + mount -o loop,ro -t ext3 $CDMNT/$LIVEOS/ext3fs.img $CDMNT cp $CDMNT/boot/efi/EFI/redhat/grub.efi $USBMNT/EFI/boot/boot.efi cp $CDMNT/boot/grub/splash.xpm.gz $USBMNT/EFI/boot/splash.xpm.gz if [ -d $CDMNT/lib64 ]; then efiarch="x64" ; else efiarch="ia32"; fi @@ -546,15 +551,16 @@ echo "Updating boot config file" # adjust label and fstype 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 if [ "$overlaysizemb" -gt 0 ]; then echo "Initializing persistent overlay file" OVERFILE="overlay-$( /lib/udev/vol_id -l $USBDEV )-$( /lib/udev/vol_id -u $USBDEV )" if [ "$USBFS" = "vfat" ]; then # vfat can't handle sparse files - dd if=/dev/zero of=$USBMNT/LiveOS/$OVERFILE count=$overlaysizemb bs=1M + 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 + dd if=/dev/null of=$USBMNT/$LIVEOS/$OVERFILE count=1 bs=1M seek=$overlaysizemb fi sed -i -e "s/liveimg/liveimg overlay=${USBLABEL}/" $BOOTCONFIG $BOOTCONFIG_EFI sed -i -e "s/\ ro\ /\ rw\ /" $BOOTCONFIG $BOOTCONFIG_EFI @@ -562,8 +568,8 @@ fi if [ "$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 + 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 @@ -572,13 +578,13 @@ if [ "$homesizemb" -gt 0 ]; then [ -n "$cryptedhome" ] && homesource=/dev/urandom if [ "$USBFS" = "vfat" ]; then # vfat can't handle sparse files - dd if=${homesource} of=$USBMNT/LiveOS/$HOMEFILE count=$homesizemb bs=1M + dd if=${homesource} of=$USBMNT/$LIVEOS/$HOMEFILE count=$homesizemb bs=1M else - dd if=/dev/null of=$USBMNT/LiveOS/$HOMEFILE count=1 bs=1M seek=$homesizemb + dd if=/dev/null of=$USBMNT/$LIVEOS/$HOMEFILE count=1 bs=1M seek=$homesizemb fi if [ -n "$cryptedhome" ]; then loop=$(losetup -f) - losetup $loop $USBMNT/LiveOS/$HOMEFILE + losetup $loop $USBMNT/$LIVEOS/$HOMEFILE setupworked=1 until [ ${setupworked} == 0 ]; do echo "Encrypting persistent /home" @@ -597,8 +603,8 @@ if [ "$homesizemb" -gt 0 ]; then losetup -d $loop else echo "Formatting unencrypted /home" - mke2fs -F -j $USBMNT/LiveOS/$HOMEFILE - tune2fs -c0 -i0 -ouser_xattr,acl $USBMNT/LiveOS/$HOMEFILE + mke2fs -F -j $USBMNT/$LIVEOS/$HOMEFILE + tune2fs -c0 -i0 -ouser_xattr,acl $USBMNT/$LIVEOS/$HOMEFILE fi fi @@ -608,7 +614,7 @@ fi if [ -n "$xo" ]; then echo "Setting up /boot/olpc.fth file" args=$(egrep "^[ ]*append" $USBMNT/$SYSLINUXPATH/isolinux.cfg |head -n1 |sed -e 's/.*initrd=[^ ]*//') - if [ -z "$xonohome" -a ! -f $USBMNT/LiveOS/$HOMEFILE ]; then + if [ -z "$xonohome" -a ! -f $USBMNT/$LIVEOS/$HOMEFILE ]; then args="$args persistenthome=mtd0" fi args="$args reset_overlay" -- Fedora-livecd-list mailing list Fedora-livecd-list@redhat.com https://www.redhat.com/mailman/listinfo/fedora-livecd-list