Makefile                    |    2 
 imgcreate/creator.py        |    6 +
 imgcreate/fs.py             |    2 
 imgcreate/live.py           |   63 +++++++----
 imgcreate/yuminst.py        |    1 
 tools/edit-livecd           |   36 ++++--
 tools/livecd-iso-to-disk.sh |  250 ++++++++++++++++++++++++++++++--------------
 7 files changed, 248 insertions(+), 112 deletions(-)

New commits:
commit 0dd05bb1a8562818fda382aa756c47231d8d5218
Author: Brian C. Lane <[email protected]>
Date:   Wed Feb 29 17:00:03 2012 -0800

    Version 16.11

diff --git a/Makefile b/Makefile
index 68804c8..ebaccb2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
-VERSION = 16.10
+VERSION = 16.11
 
 INSTALL = /usr/bin/install -c
 INSTALL_PROGRAM = ${INSTALL}


commit efaa8cbc6e15e903e39605757ebf3b36b271fc7b
Author: Brian C. Lane <[email protected]>
Date:   Wed Feb 29 16:24:37 2012 -0800

    livecd-iso-to-disk: Add 2MB slop to calculation

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index b443b91..b5adf1e 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -432,7 +432,7 @@ createGPTLayout() {
     else
         p2_size=0
     fi
-    p1_size=$(($dev_size - 1 - $p2_size))
+    p1_size=$(($dev_size - 3 - $p2_size))
 
     if [ $p1_size -le 0 ]; then
         echo "Your device isn't big enough to hold $SRC"
@@ -485,7 +485,7 @@ createMSDOSLayout() {
     else
         p2_size=0
     fi
-    p1_size=$(($dev_size - 1 - $p2_size))
+    p1_size=$(($dev_size - 3 - $p2_size))
 
     if [ $p1_size -le 0 ]; then
         echo "Your device isn't big enough to hold $SRC"
@@ -542,7 +542,7 @@ createEXTFSLayout() {
     else
         p2_size=0
     fi
-    p1_size=$(($dev_size - 1 - $p2_size))
+    p1_size=$(($dev_size - 3 - $p2_size))
 
     if [ $p1_size -le 0 ]; then
         echo "Your device isn't big enough to hold $SRC"


commit 3ee5eb236e7c493e9c9a54d2106a0d1f88af35c6
Author: Matthew Garrett <[email protected]>
Date:   Wed Feb 29 14:57:58 2012 -0500

    Change EFI/boot to EFI/BOOT
    
    Fix this up for consistency with other build tools

diff --git a/imgcreate/live.py b/imgcreate/live.py
index d50b595..49fbf3c 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -231,9 +231,9 @@ class LiveImageCreatorBase(LoopImageCreator):
         """Generate EFI boot images."""
         if not os.path.exists(self._instroot + 
"/boot/efi/EFI/redhat/grub.efi"):
             return False
-        subprocess.call(["mkefiboot", isodir + "/EFI/boot",
+        subprocess.call(["mkefiboot", isodir + "/EFI/BOOT",
                          isodir + "/isolinux/efiboot.img"])
-        subprocess.call(["mkefiboot", "-a", isodir + "/EFI/boot",
+        subprocess.call(["mkefiboot", "-a", isodir + "/EFI/BOOT",
                          isodir + "/isolinux/macboot.img"])
 
     def _create_bootconfig(self):
@@ -687,19 +687,19 @@ menu end
         if not os.path.exists(self._instroot + 
"/boot/efi/EFI/redhat/grub.efi"):
             return False
         shutil.copy(self._instroot + "/boot/efi/EFI/redhat/grub.efi",
-                    isodir + "/EFI/boot/grub.efi")
+                    isodir + "/EFI/BOOT/grub.efi")
 
         # Should exist, but if it doesn't we should fail
         if os.path.exists(self._instroot + "/boot/grub/splash.xpm.gz"):
             shutil.copy(self._instroot + "/boot/grub/splash.xpm.gz",
-                        isodir + "/EFI/boot/splash.xpm.gz")
+                        isodir + "/EFI/BOOT/splash.xpm.gz")
 
         return True
 
     def __get_basic_efi_config(self, **args):
         return """
 default=0
-splashimage=/EFI/boot/splash.xpm.gz
+splashimage=/EFI/BOOT/splash.xpm.gz
 timeout %(timeout)d
 hiddenmenu
 
@@ -712,8 +712,8 @@ hiddenmenu
             args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
         return """title %(long)s
   findiso
-  kernel /EFI/boot/vmlinuz%(index)s root=%(rootlabel)s 
rootfstype=%(isofstype)s %(liveargs)s %(extra)s
-  initrd /EFI/boot/initrd%(index)s.img
+  kernel /EFI/BOOT/vmlinuz%(index)s root=%(rootlabel)s 
rootfstype=%(isofstype)s %(liveargs)s %(extra)s
+  initrd /EFI/BOOT/initrd%(index)s.img
 """ %args
 
     def __get_efi_image_stanzas(self, isodir, name):
@@ -731,7 +731,7 @@ hiddenmenu
         cfg = ""
         for index in range(0, 9):
             # we don't support xen kernels
-            if os.path.exists("%s/EFI/boot/xen%d.gz" %(isodir, index)):
+            if os.path.exists("%s/EFI/BOOT/xen%d.gz" %(isodir, index)):
                 continue
             cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
                                                isofstype = "auto",
@@ -751,7 +751,7 @@ hiddenmenu
 
     def _configure_efi_bootloader(self, isodir):
         """Set up the configuration for an EFI bootloader"""
-        makedirs(isodir + "/EFI/boot")
+        makedirs(isodir + "/EFI/BOOT")
 
         if not self.__copy_efi_files(isodir):
             shutil.rmtree(isodir + "/EFI")
@@ -759,27 +759,27 @@ hiddenmenu
 
         for f in os.listdir(isodir + "/isolinux"):
             os.link("%s/isolinux/%s" %(isodir, f),
-                    "%s/EFI/boot/%s" %(isodir, f))
+                    "%s/EFI/BOOT/%s" %(isodir, f))
 
 
         cfg = self.__get_basic_efi_config(name = self.name,
                                           timeout = self._timeout)
         cfg += self.__get_efi_image_stanzas(isodir, self.name)
 
-        cfgf = open(isodir + "/EFI/boot/grub.conf", "w")
+        cfgf = open(isodir + "/EFI/BOOT/grub.conf", "w")
         cfgf.write(cfg)
         cfgf.close()
 
         # first gen mactel machines get the bootloader name wrong apparently
         if rpmUtils.arch.getBaseArch() == "i386":
-            os.link(isodir + "/EFI/boot/grub.efi", isodir + 
"/EFI/boot/boot.efi")
-            os.link(isodir + "/EFI/boot/grub.conf", isodir + 
"/EFI/boot/boot.conf")
+            os.link(isodir + "/EFI/BOOT/grub.efi", isodir + 
"/EFI/BOOT/BOOT.efi")
+            os.link(isodir + "/EFI/BOOT/grub.conf", isodir + 
"/EFI/BOOT/BOOT.conf")
 
         # for most things, we want them named boot$efiarch
         efiarch = {"i386": "ia32", "x86_64": "x64"}
         efiname = efiarch[rpmUtils.arch.getBaseArch()]
-        os.rename(isodir + "/EFI/boot/grub.efi", isodir + 
"/EFI/boot/boot%s.efi" %(efiname,))
-        os.link(isodir + "/EFI/boot/grub.conf", isodir + 
"/EFI/boot/boot%s.conf" %(efiname,))
+        os.rename(isodir + "/EFI/BOOT/grub.efi", isodir + 
"/EFI/BOOT/BOOT%s.efi" %(efiname,))
+        os.link(isodir + "/EFI/BOOT/grub.conf", isodir + 
"/EFI/BOOT/BOOT%s.conf" %(efiname,))
 
 
     def _configure_bootloader(self, isodir):
diff --git a/tools/edit-livecd b/tools/edit-livecd
index 0df2fa8..948064b 100755
--- a/tools/edit-livecd
+++ b/tools/edit-livecd
@@ -640,9 +640,9 @@ def get_fsvalue(filesystem, tag):
 
 def rebuild_iso_symlinks(isodir):
     # remove duplicate files and rebuild symlinks to reduce iso size
-    efi_vmlinuz = "%s/EFI/boot/vmlinuz0" % isodir
+    efi_vmlinuz = "%s/EFI/BOOT/vmlinuz0" % isodir
     isolinux_vmlinuz = "%s/isolinux/vmlinuz0" % isodir
-    efi_initrd = "%s/EFI/boot/initrd0.img" % isodir
+    efi_initrd = "%s/EFI/BOOT/initrd0.img" % isodir
     isolinux_initrd = "%s/isolinux/initrd0.img" % isodir
 
     if os.path.exists(efi_vmlinuz):
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 84c6bba..b443b91 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1397,7 +1397,7 @@ if [ -z "$multi" ]; then
     echo "Installing boot loader"
     if [ -n "$efi" ]; then
         # replace the ia32 hack
-        if [ -f "$TGTMNT$EFI_BOOT/boot.conf" ]; then
+        if [ -f "$TGTMNT$EFI_BOOT/BOOT.conf" ]; then
             cp -f $TGTMNT$EFI_BOOT/BOOTia32.conf $TGTMNT$EFI_BOOT/BOOT.conf
         fi
     fi


commit 755c60c5a71627689914356486dd9d37af9ce358
Author: Matthew Garrett <[email protected]>
Date:   Wed Feb 29 14:57:57 2012 -0500

    Add support for generating EFI-bootable hybrid images
    
    This patch adds support for generating efiboot and macboot images, passing
    them to the ISO generation and then performing the appropriate isohybrid
    call.

diff --git a/imgcreate/live.py b/imgcreate/live.py
index c7904e9..d50b595 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -227,9 +227,19 @@ class LiveImageCreatorBase(LoopImageCreator):
             self.__isodir = self._mkdtemp("iso-")
         return self.__isodir
 
+    def _generate_efiboot(self, isodir):
+        """Generate EFI boot images."""
+        if not os.path.exists(self._instroot + 
"/boot/efi/EFI/redhat/grub.efi"):
+            return False
+        subprocess.call(["mkefiboot", isodir + "/EFI/boot",
+                         isodir + "/isolinux/efiboot.img"])
+        subprocess.call(["mkefiboot", "-a", isodir + "/EFI/boot",
+                         isodir + "/isolinux/macboot.img"])
+
     def _create_bootconfig(self):
         """Configure the image so that it's bootable."""
         self._configure_bootloader(self.__ensure_isodir())
+        self._generate_efiboot(self.__ensure_isodir())
 
     def _get_post_scripts_env(self, in_chroot):
         env = LoopImageCreator._get_post_scripts_env(self, in_chroot)
@@ -305,7 +315,10 @@ class LiveImageCreatorBase(LoopImageCreator):
             raise CreatorError("ISO creation failed!")
 
         if os.path.exists("/usr/bin/isohybrid"):
-            subprocess.call(["/usr/bin/isohybrid", iso])
+            if os.path.exists(isodir + "/isolinux/efiboot.img"):
+                subprocess.call(["/usr/bin/isohybrid", "-u", "-m", iso])
+            else:
+                subprocess.call(["/usr/bin/isohybrid", iso])
 
         self.__implant_md5sum(iso)
 
@@ -358,10 +371,18 @@ class LiveImageCreatorBase(LoopImageCreator):
 class x86LiveImageCreator(LiveImageCreatorBase):
     """ImageCreator for x86 machines"""
     def _get_mkisofs_options(self, isodir):
-        return [ "-b", "isolinux/isolinux.bin",
-                 "-c", "isolinux/boot.cat",
-                 "-no-emul-boot", "-boot-info-table",
-                 "-boot-load-size", "4" ]
+        options = [ "-b", "isolinux/isolinux.bin",
+                    "-c", "isolinux/boot.cat",
+                    "-no-emul-boot", "-boot-info-table",
+                    "-boot-load-size", "4" ]
+        if os.path.exists(isodir + "/isolinux/efiboot.img"):
+            options.extend([ "-eltorito-alt-boot",
+                             "-e", "isolinux/efiboot.img",
+                             "-no-emul-boot",
+                             "-eltorito-alt-boot",
+                             "-e", "isolinux/macboot.img",
+                             "-no-emul-boot"])
+        return options
 
     def _get_required_packages(self):
         return ["syslinux"] + LiveImageCreatorBase._get_required_packages(self)
@@ -690,6 +711,7 @@ hiddenmenu
         else:
             args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
         return """title %(long)s
+  findiso
   kernel /EFI/boot/vmlinuz%(index)s root=%(rootlabel)s 
rootfstype=%(isofstype)s %(liveargs)s %(extra)s
   initrd /EFI/boot/initrd%(index)s.img
 """ %args


commit 1cdc51b5d298045f73d5f94e7524ab2059fb5451
Author: Brian C. Lane <[email protected]>
Date:   Tue Feb 21 14:55:51 2012 -0800

    livecd-iso-to-disk: create partition for iso
    
    In Fedora 17 the installer runs from the squashfs.img on the install
    media. This means that the installer environment doesn't have direct
    access to the install media, and it cannot mount it.
    
    In order to support writing DVD's to USB sticks we now need to create a
    second partition just for the .iso image and direct the installer to it
    using the repo=UUID=... command
    
    This patch adds creating the 2nd partition if needed and also cleans up
    some of the bootloader config editing code.

diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index dcc152d..84c6bba 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -1,7 +1,9 @@
 #!/bin/bash
 # Transfer a Live image so that it's bootable off of a USB/SD device.
-# Copyright 2007  Red Hat, Inc.
+# Copyright 2007-2012  Red Hat, Inc.
+#
 # Jeremy Katz <[email protected]>
+# Brian C. Lane <[email protected]>
 #
 # overlay/persistence enhancements by Douglas McClendon <[email protected]>
 # GPT+MBR hybrid enhancements by Stewart Adam <[email protected]>
@@ -274,11 +276,14 @@ cleanup() {
     sleep 2
     [ -d "$SRCMNT" ] && umount $SRCMNT && rmdir $SRCMNT
     [ -d "$TGTMNT" ] && umount $TGTMNT && rmdir $TGTMNT
+    if [ -n "$REPOMNT" ]; then
+        [ -d "$REPOMNT" ] && umount $REPOMNT && rmdir $REPOMNT
+    fi
 }
 
 exitclean() {
     RETVAL=$?
-    if [ -d "$SRCMNT" ] || [ -d "$TGTMNT" ];
+    if [ -d "$SRCMNT" ] || [ -d "$TGTMNT" ] || [ -n "$REPOMNT" ];
     then
         [ "$RETVAL" = 0 ] || echo "Cleaning up to exit..."
         cleanup
@@ -319,13 +324,6 @@ getdisk() {
     partnum=${p##$device}
 }
 
-getpartition() {
-    DEV=$1
-    pa=$( < /proc/partitions )
-    pa=${pa##*$DEV}
-    partnum=${pa%% *}
-}
-
 resetMBR() {
     if isdevloop "$DEV"; then
         return
@@ -423,18 +421,47 @@ createGPTLayout() {
     umount ${device}* &> /dev/null || :
     wipefs -a ${device}
     /sbin/parted --script $device mklabel gpt
-    partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep 
^$device:)
-    size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
-    /sbin/parted --script $device unit b mkpart '"EFI System Partition"' fat32 
1048576 $(($size - 1048576)) set 1 boot on
+    partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit MB print" |grep 
^$device:)
+    dev_size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/MB$//')
+
+    # Is a 2nd partition needed for package iso?
+    if [ -n "$packages" ]; then
+        src_size=$(du -s -B 1MB "$SRC" | awk {'print $1;'})
+        # iso size + 7% of slop for filesystem metadata
+        p2_size=$(($src_size * 107 / 100))
+    else
+        p2_size=0
+    fi
+    p1_size=$(($dev_size - 1 - $p2_size))
+
+    if [ $p1_size -le 0 ]; then
+        echo "Your device isn't big enough to hold $SRC"
+        echo "It is $(($p1_size * -1)) MB too small"
+        exitclean
+    fi
+    p1_start=1
+    p1_end=$(($p1_size + 1))
+    /sbin/parted -s $device u MB mkpart '"EFI System Partition"' fat32 
$p1_start $p1_end set 1 boot on
+    if [ $p2_size -gt 0 ]; then
+        p2_start=$p1_end
+        p2_end=$(($p2_size + $p2_start))
+        /sbin/parted -s $device u MB mkpart '"LIVE REPO"' fat32 $p2_start 
$p2_end
+    fi
     # Sometimes automount can be _really_ annoying.
     echo "Waiting for devices to settle..."
     /sbin/udevadm settle
     sleep 5
-    getpartition ${device#/dev/}
-    TGTDEV=${device}${partnum}
+    TGTDEV=${device}1
     umount $TGTDEV &> /dev/null || :
     /sbin/mkdosfs -n LIVE $TGTDEV
     TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
+
+    if [ $p2_size -gt 0 ]; then
+        REPODEV=${device}2
+        umount $REPODEV &> /dev/null || :
+        /sbin/mkdosfs -n LIVE-REPO $REPODEV
+        REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
+    fi
 }
 
 createMSDOSLayout() {
@@ -447,22 +474,51 @@ createMSDOSLayout() {
     umount ${device}* &> /dev/null || :
     wipefs -a ${device}
     /sbin/parted --script $device mklabel msdos
-    partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep 
^$device:)
-    size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
-    /sbin/parted --script $device unit b mkpart primary fat32 1048576 $(($size 
- 1048576)) set 1 boot on
+    partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit MB print" |grep 
^$device:)
+    dev_size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/MB$//')
+
+    # Is a 2nd partition needed for package iso?
+    if [ -n "$packages" ]; then
+        src_size=$(du -s -B 1MB "$SRC" | awk {'print $1;'})
+        # iso size + 7% of slop for filesystem metadata
+        p2_size=$(($src_size * 107 / 100))
+    else
+        p2_size=0
+    fi
+    p1_size=$(($dev_size - 1 - $p2_size))
+
+    if [ $p1_size -le 0 ]; then
+        echo "Your device isn't big enough to hold $SRC"
+        echo "It is $(($p1_size * -1)) MB too small"
+        exitclean
+    fi
+    p1_start=1
+    p1_end=$(($p1_size + 1))
+    /sbin/parted -s $device u MB mkpart primary fat32 $p1_start $p1_end set 1 
boot on
+    if [ $p2_size -gt 0 ]; then
+        p2_start=$p1_end
+        p2_end=$(($p2_size + $p2_start))
+        /sbin/parted -s $device u MB mkpart primary fat32 $p2_start $p2_end
+    fi
     # Sometimes automount can be _really_ annoying.
     echo "Waiting for devices to settle..."
     /sbin/udevadm settle
     sleep 5
     if ! isdevloop "$DEV"; then
-        getpartition ${device#/dev/}
-        TGTDEV=${device}${partnum}
+        TGTDEV=${device}1
     else
         TGTDEV=${device}
     fi
     umount $TGTDEV &> /dev/null || :
     /sbin/mkdosfs -n LIVE $TGTDEV
     TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
+
+    if [ $p2_size -gt 0 ]; then
+        REPODEV=${device}2
+        umount $REPODEV &> /dev/null || :
+        /sbin/mkdosfs -n LIVE-REPO $REPODEV
+        REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
+    fi
 }
 
 createEXTFSLayout() {
@@ -474,25 +530,55 @@ createEXTFSLayout() {
     read
     umount ${device}* &> /dev/null || :
     wipefs -a ${device}
-    /sbin/parted --script $device mklabel msdos
-    partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep 
^$device:)
-    size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//')
-    /sbin/parted --script $device unit b mkpart primary ext2 1048576 $(($size 
- 1048576)) set 1 boot on
+    /sbin/parted -s $device mklabel msdos
+    partinfo=$(LC_ALL=C /sbin/parted -s -m $device "u MB print" |grep 
^$device:)
+    dev_size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/MB$//')
+
+    # Is a 2nd partition needed for package iso?
+    if [ -n "$packages" ]; then
+        src_size=$(du -s -B 1MB "$SRC" | awk {'print $1;'})
+        # iso size + 7% of slop for filesystem metadata
+        p2_size=$(($src_size * 107 / 100))
+    else
+        p2_size=0
+    fi
+    p1_size=$(($dev_size - 1 - $p2_size))
+
+    if [ $p1_size -le 0 ]; then
+        echo "Your device isn't big enough to hold $SRC"
+        echo "It is $(($p1_size * -1)) MB too small"
+        exitclean
+    fi
+    p1_start=1
+    p1_end=$(($p1_size + 1))
+    /sbin/parted -s $device u MB mkpart primary ext2 $p1_start $p1_end set 1 
boot on
+    if [ $p2_size -gt 0 ]; then
+        p2_start=$p1_end
+        p2_end=$(($p2_size + $p2_start))
+        /sbin/parted -s $device u MB mkpart primary ext2 $p2_start $p2_end
+    fi
     # Sometimes automount can be _really_ annoying.
     echo "Waiting for devices to settle..."
     /sbin/udevadm settle
     sleep 5
-    getpartition ${device#/dev/}
-    TGTDEV=${device}${partnum}
+    TGTDEV=${device}1
     umount $TGTDEV &> /dev/null || :
 
     # Check extlinux version
     if extlinux -v 2>&1 | grep -q 'extlinux 3'; then
-        /sbin/mkfs.ext3 -L LIVE $TGTDEV
+        mkfs=/sbin/mkfs.ext3
     else
-        /sbin/mkfs.ext4 -L LIVE $TGTDEV
+        mkfs=/sbin/mkfs.ext4
     fi
+    $mkfs -L LIVE $TGTDEV
     TGTLABEL="UUID=$(/sbin/blkid -s UUID -o value $TGTDEV)"
+
+    if [ $p2_size -gt 0 ]; then
+        REPODEV=${device}2
+        umount $REPODEV &> /dev/null || :
+        $mkfs -L LIVE-REPO $REPODEV
+        REPOLABEL="UUID=$(/sbin/blkid -s UUID -o value $REPODEV)"
+    fi
 }
 
 checkGPT() {
@@ -607,17 +693,24 @@ if [ $(id -u) != 0 ]; then
 fi
 
 detectsrctype() {
-    if [[ -e $SRCMNT/LiveOS/squashfs.img ]]; then
+    if [[ -e "$SRCMNT/Packages" ]]; then
+        # This will cause the source .iso to be copied to a second partiton
+        # on the target and the boot args to have repo=... pointing to the iso
+        echo "/Packages found, will copy source .iso to target"
+        packages=1
+    fi
+    if [[ -e "$SRCMNT/LiveOS/squashfs.img" ]]; then
+        # LiveOS style boot image
         srctype=live
         return
     fi
     if [ -e $SRCMNT/images/install.img -o $SRCMNT/isolinux/initrd.img ]; then
-        imgtype=install
-        if [ -e $SRCMNT/Packages ]; then
+        if [ -n "$packages" ]; then
             srctype=installer
         else
             srctype=netinst
         fi
+        imgtype=install
         if [ ! -e $SRCMNT/images/install.img ]; then
             echo "$SRC uses initrd.img w/o install.img"
             imgtype=initrd
@@ -674,6 +767,7 @@ swapsizemb=0
 overlaysizemb=0
 srctype=
 imgtype=
+packages=
 LIVEOS=LiveOS
 HOMEFILE="home.img"
 
@@ -813,6 +907,19 @@ fi
 # do some basic sanity checks.
 checkMounted $TGTDEV
 
+# FIXME: would be better if we had better mountpoints
+SRCMNT=$(mktemp -d /media/srctmp.XXXXXX)
+if [ -b "$SRC" ]; then
+    mount -o ro "$SRC" $SRCMNT || exitclean
+elif [ -f "$SRC" ]; then
+    mount -o loop,ro "$SRC" $SRCMNT || exitclean
+else
+    echo "$SRC is not a file or block device."
+    exitclean
+fi
+# Figure out what needs to be done based on the source image
+detectsrctype
+
 # Format the device
 if [ -n "$format" -a -z "$skipcopy" ]; then
     checkLVM $TGTDEV
@@ -865,23 +972,15 @@ if [ "$swapsizemb" -gt 0 -a "$TGTFS" = "vfat" ]; then
     fi
 fi
 
-# FIXME: would be better if we had better mountpoints
-SRCMNT=$(mktemp -d /media/srctmp.XXXXXX)
-if [ -b "$SRC" ]; then
-    mount -o ro "$SRC" $SRCMNT || exitclean
-elif [ -f "$SRC" ]; then
-    mount -o loop,ro "$SRC" $SRCMNT || exitclean
-else
-    echo "$SRC is not a file or block device."
-    exitclean
-fi
 TGTMNT=$(mktemp -d /media/tgttmp.XXXXXX)
 mount $mountopts $TGTDEV $TGTMNT || exitclean
+if [ -n "$REPODEV" ]; then
+    REPOMNT=$(mktemp -d /media/repotmp.XXXXXX)
+    mount $mountopts $REPODEV $REPOMNT || exitclean
+fi
 
 trap exitclean SIGINT SIGTERM
 
-detectsrctype
-
 if [ -f "$TGTMNT/$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"
@@ -979,11 +1078,6 @@ fi
 
 # Verify available space for DVD installer
 if [ "$srctype" = "installer" ]; then
-    if [ -z "$skipcopy" ]; then
-        srcsize=$(du -s -B 1M "$SRC" | awk {'print $1;'})
-    else
-        srcsize=0
-    fi
     if [ "$imgtype" = "install" ]; then
         imgpath=images/install.img
     else
@@ -998,10 +1092,9 @@ if [ "$srctype" = "installer" ]; then
     if [ -e $TGTMNT/$(basename "$SRC") ]; then
         tbd=$(($tbd + $(du -s -B 1M $TGTMNT/$(basename "$SRC") | awk {'print 
$1;'})))
     fi
-    echo "Size of DVD image: $srcsize"
     echo "Size of $imgpath: $installimgsize"
     echo "Available space: $((freespace + tbd))"
-    if (( ((srcsize + installimgsize)) > ((freespace + tbd)) )); then
+    if (( installimgsize > ((freespace + tbd)) )); then
         echo "ERROR: Unable to fit DVD image + install.img on available space 
on the target device."
         exitclean
     fi
@@ -1051,6 +1144,7 @@ if [ "$srctype" = "live" -a -z "$skipcopy" ]; then
 fi
 
 # DVD installer copy
+# Also copies over the source .iso if the image is a new-style LiveOS DVD 
(F17+)
 if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then
     echo "Copying DVD image to target device."
     mkdir -p $TGTMNT/images/
@@ -1061,9 +1155,12 @@ if [ \( "$srctype" = "installer" -o "$srctype" = 
"netinst" \) ]; then
             fi
         done
     fi
-    if [ "$srctype" = "installer" -a -z "$skipcopy" ]; then
-        copyFile "$SRC" $TGTMNT/
-    fi
+fi
+
+# Copy source .iso to repo partition
+if [ -n "$packages" -a -z "$skipcopy" ]; then
+    echo "Copying $SRC"
+    copyFile "$SRC" $REPOMNT/
     sync
 fi
 
@@ -1139,40 +1236,45 @@ if [[ live == $srctype ]]; then
                -e "/^totaltimeout.*$/d" $BOOTCONFIG
     fi
 fi
+
+
 echo "Updating boot config file"
 # adjust label and fstype
-if [ -n "$LANG" ]; then
-    kernelargs="$kernelargs LANG=$LANG"
-fi
 sed -i -e "s/CDLABEL=[^ ]*/$TGTLABEL/" -e "s/rootfstype=[^ 
]*/rootfstype=$TGTFS/" -e "s/LABEL=[^ ]*/$TGTLABEL/" $BOOTCONFIG  
$BOOTCONFIG_EFI
 if [ -n "$kernelargs" ]; then
-    sed -i -e "s/liveimg/liveimg ${kernelargs}/" $BOOTCONFIG $BOOTCONFIG_EFI
+    sed -i -e "s;initrd.img;initrd.img ${kernelargs};" $BOOTCONFIG
+    if [ -n "$efi" ]; then
+        sed -i -e "s;vmlinuz;vmlinuz ${kernelargs};" $BOOTCONFIG_EFI
+    fi
 fi
 if [ "$LIVEOS" != "LiveOS" ]; then
     sed -i -e "s;liveimg;liveimg live_dir=$LIVEOS;" $BOOTCONFIG $BOOTCONFIG_EFI
 fi
 
-# DVD Installer
-if [ "$srctype" = "installer" ]; then
-    sed -i -e "s;initrd=initrd.img;initrd=initrd.img ${LANG:+LANG=$LANG} 
repo=hd:$TGTLABEL:/;g" $BOOTCONFIG
-    sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG
+# EFI images are in $SYSLINUXPATH now
+if [ -n "$efi" ]; then
+    sed -i -e "s;/images/pxeboot/;/$SYSLINUXPATH/;g" $BOOTCONFIG_EFI
+    sed -i -e "s;findiso;;g" $BOOTCONFIG_EFI
+fi
+
+# Add repo= to point to the source .iso with the packages
+if [[ -n "$packages" ]]; then
+    sed -i -e "s;initrd.img;initrd.img repo=hd:$REPOLABEL:/;g" $BOOTCONFIG
     if [ -n "$efi" ]; then
-        # Images are in $SYSLINUXPATH now
-        sed -i -e "s;/images/pxeboot/;/$SYSLINUXPATH/;g" -e "s;vmlinuz;vmlinuz 
${LANG:+LANG=$LANG} repo=hd:$TGTLABEL:/;g" $BOOTCONFIG_EFI
+        sed -i -e "s;vmlinuz;vmlinuz repo=hd:$REPOLABEL:/;g" $BOOTCONFIG_EFI
     fi
 fi
 
 # DVD Installer for netinst
-if [ "$srctype" = "netinst" ]; then
+if [ "$srctype" != "live" ]; then
     if [ "$imgtype" = "install" ]; then
-        sed -i -e "s;stage2=\S*;stage2=hd:$TGTLABEL:/images/install.img;g" 
$BOOTCONFIG
+        sed -i -e "s;initrd.img;initrd.img 
stage2=hd:$TGTLABEL:/images/install.img;g" $BOOTCONFIG
+        if [ -n "$efi" ]; then
+            sed -i -e "s;vmlinuz;vmlinuz 
stage2=hd:$TGTLABEL:/images/install.img;g" $BOOTCONFIG_EFI
+        fi
     else
         # The initrd has everything, so no stage2
-        sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG
-    fi
-    if [ -n "$efi" ]; then
-        # Images are in $SYSLINUXPATH now
-        sed -ie "s;/images/pxeboot/;/$SYSLINUXPATH/;g" $BOOTCONFIG_EFI
+        sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
     fi
 fi
 
@@ -1184,14 +1286,6 @@ if [ -n "$totaltimeout" ]; then
     sed -i -e "/^timeout.*$/a\totaltimeout\ $totaltimeout" $BOOTCONFIG
 fi
 
-# Use repo if the .iso has the repository on it, otherwise use stage2 which
-# will default to using the network mirror
-if [ -e "$SRCMNT/.discinfo" ]; then
-    METHODSTR=repo
-else
-    METHODSTR=stage2
-fi
-
 if [ "$overlaysizemb" -gt 0 ]; then
     echo "Initializing persistent overlay file"
     OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $TGTDEV )-$( 
/sbin/blkid -s UUID -o value $TGTDEV )"


commit 87a719bfb99d95b876fcc136e0f0c5f17ccc8870
Author: Joey Boggs <[email protected]>
Date:   Mon Feb 13 21:40:56 2012 -0500

    check for valid script path before editing livecd image and update usage 
options confusion

diff --git a/tools/edit-livecd b/tools/edit-livecd
index 72ec059..0df2fa8 100755
--- a/tools/edit-livecd
+++ b/tools/edit-livecd
@@ -543,17 +543,17 @@ class LiveImageEditor(LiveImageCreator):
 def parse_options(args):
     parser = optparse.OptionParser(usage = """
        %prog [-n=<name>]
-                      [-o=<output>]
-                      [-k=<kickstart-file>]
-                      [-s=<script.sh>]
-                      [-t=<tmpdir>]
-                      [-e=<excludes>]
-                      [-f=<exclude-file>]
-                      [-i=<includes>]
-                      [-r=<releasefile>]
-                      [-b=<builder>]
+                      [-o <output>]
+                      [-k <kickstart-file>]
+                      [-s <script.sh>]
+                      [-t <tmpdir>]
+                      [-e <excludes>]
+                      [-f <exclude-file>]
+                      [-i <includes>]
+                      [-r <releasefile>]
+                      [-b <builder>]
                       [--clone]
-                      [-c=<compress_type>]
+                      [-c <compress_type>]
                       [--skip-compression]
                       [--skip-minimize]
                       <LIVEIMG.src>""")
@@ -690,6 +690,10 @@ def main():
             editor.ks = read_kickstart(options.kscfg)
             # part / --size <new rootfs size to be resized to>
             editor._LoopImageCreator__image_size = 
kickstart.get_image_size(editor.ks)
+        if options.script:
+            if not os.path.exists(options.script):
+                print "Invalid Script Path '%s'" % options.script
+                return 1
         editor.mount(LiveOS, cachedir = None)
         editor._configure_bootloader(editor._LiveImageCreatorBase__isodir)
         if editor.ks:


commit 62555335e3b90f9eec872c9cb3444c87ccde4d79
Author: Brian C. Lane <[email protected]>
Date:   Mon Jan 30 13:11:54 2012 -0800

    imgcreate: fix typo in ResizeError

diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index a387f51..da444e4 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -105,7 +105,7 @@ def resize2fs(fs, size = None, minimal = False, tmpdir = 
"/tmp"):
 
     ret = e2fsck(fs)
     if ret != 0:
-        raise ResizeError("fsck after resize returned an error (%d)!", (ret,))
+        raise ResizeError("fsck after resize returned an error (%d)!" % (ret,))
 
     return 0
 


commit 64d444849955c6e259fb5a7633211b745ee368e4
Author: Joey Boggs <[email protected]>
Date:   Tue Jan 24 13:54:18 2012 -0500

    add missing selinux_mountpoint class object to edit-livecd

diff --git a/tools/edit-livecd b/tools/edit-livecd
index ab86960..72ec059 100755
--- a/tools/edit-livecd
+++ b/tools/edit-livecd
@@ -117,6 +117,14 @@ class LiveImageEditor(LiveImageCreator):
         self.ks = None
         """optional kickstart file as a recipe for editing the image"""
 
+        self._ImageCreator__selinux_mountpoint = "/sys/fs/selinux"
+        with open("/proc/self/mountinfo", "r") as f:
+            for line in f.readlines():
+                fields = line.split()
+                if fields[-2] == "selinuxfs":
+                    self.__ImageCreator__selinux_mountpoint = fields[4]
+                    break
+
     # properties
     def __get_image(self):
         if self._LoopImageCreator__imagedir is None:


commit 06171abb02685670fd45bf9d6c42fdb2690f4ba5
Author: Brian C. Lane <[email protected]>
Date:   Wed Jan 18 16:18:25 2012 -0800

    selinux may be off on the host, skip mount (#737064)

diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 745a481..e09bdcf 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -445,6 +445,9 @@ class ImageCreator(object):
         os.umask(origumask)
 
     def __create_selinuxfs(self):
+        if not os.path.exists(self.__selinux_mountpoint):
+            return
+
         arglist = ["/bin/mount", "--bind", "/dev/null", self._instroot + 
self.__selinux_mountpoint + "/load"]
         subprocess.call(arglist, close_fds = True)
 
@@ -460,6 +463,9 @@ class ImageCreator(object):
                 subprocess.call(arglist, close_fds = True)
 
     def __destroy_selinuxfs(self):
+        if not os.path.exists(self.__selinux_mountpoint):
+            return
+
         # if the system was running selinux clean up our lies
         arglist = ["/bin/umount", self._instroot + self.__selinux_mountpoint + 
"/load"]
         subprocess.call(arglist, close_fds = True)


commit 1fad9c81e0ac481323f865caacad49cd1d453a3c
Author: Brian C. Lane <[email protected]>
Date:   Wed Jan 18 15:32:06 2012 -0800

    Set base_persistdir (#741614)

diff --git a/imgcreate/yuminst.py b/imgcreate/yuminst.py
index 82a5788..d835d9f 100644
--- a/imgcreate/yuminst.py
+++ b/imgcreate/yuminst.py
@@ -164,6 +164,7 @@ class LiveCDYum(yum.YumBase):
             if v or not hasattr(repo, k):
                 repo.setAttribute(k, v)
         repo.basecachedir = self.conf.cachedir
+        repo.base_persistdir = self.conf.cachedir
         repo.failovermethod = "priority"
         repo.metadata_expire = 0
         repo.mirrorlist_expire = 0


commit 853bd70f33bbfb8040bd9d4935177630d2d5cc78
Author: Brian C. Lane <[email protected]>
Date:   Wed Jan 18 14:29:20 2012 -0800

    Fix the fix for dracut modules (#766955)

diff --git a/imgcreate/live.py b/imgcreate/live.py
index 6c3bcd8..c7904e9 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -283,7 +283,7 @@ class LiveImageCreatorBase(LoopImageCreator):
         f = open(path, "a")
         f.write('filesystems+="' + self.__extra_filesystems() + ' "\n')
         f.write('drivers+="' + self.__extra_drivers() + ' "\n')
-        f.write('dracutdrivers+="dmsquash-live "')
+        f.write('add_dracutmodules+=" dmsquash-live "')
         f.close()
 
     def __create_iso(self, isodir):


commit 647a07b99e1d1c5e2e4d158eb84fba99bfcbef97
Author: Brian C. Lane <[email protected]>
Date:   Fri Jan 13 10:18:25 2012 -0800

    Use dracut.conf.d instead fo dracut.conf

diff --git a/imgcreate/live.py b/imgcreate/live.py
index 972ff93..6c3bcd8 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -215,11 +215,11 @@ class LiveImageCreatorBase(LoopImageCreator):
         self.base_on = True
         LoopImageCreator._mount_instroot(self, base_on)
         self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")
-        self.__write_dracut_conf(self._instroot + "/etc/dracut.conf")
+        self.__write_dracut_conf(self._instroot + 
"/etc/dracut.conf.d/02livecd.conf")
 
     def _unmount_instroot(self):
         self.__restore_file(self._instroot + "/etc/sysconfig/mkinitrd")
-        self.__restore_file(self._instroot + "/etc/dracut.conf")
+        self.__restore_file(self._instroot + 
"/etc/dracut.conf.d/02livecd.conf")
         LoopImageCreator._unmount_instroot(self)
 
     def __ensure_isodir(self):
@@ -283,7 +283,7 @@ class LiveImageCreatorBase(LoopImageCreator):
         f = open(path, "a")
         f.write('filesystems+="' + self.__extra_filesystems() + ' "\n')
         f.write('drivers+="' + self.__extra_drivers() + ' "\n')
-        f.write('dracutdrivers+="dmsquash-live"')
+        f.write('dracutdrivers+="dmsquash-live "')
         f.close()
 
     def __create_iso(self, isodir):


commit 37bbf96cf2e4ff73a965036b711021a4c5f657ea
Author: Brian C. Lane <[email protected]>
Date:   Fri Jan 13 05:41:54 2012 -0800

    dracut needs dmsquash-live explicitly included

diff --git a/imgcreate/live.py b/imgcreate/live.py
index 11e8c57..972ff93 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -283,6 +283,7 @@ class LiveImageCreatorBase(LoopImageCreator):
         f = open(path, "a")
         f.write('filesystems+="' + self.__extra_filesystems() + ' "\n')
         f.write('drivers+="' + self.__extra_drivers() + ' "\n')
+        f.write('dracutdrivers+="dmsquash-live"')
         f.close()
 
     def __create_iso(self, isodir):


--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to