[Fedora-livecd-list] 2 commits - imgcreate/live.py

Brian C. Lane bcl at fedoraproject.org
Thu Mar 31 23:36:30 UTC 2011


 imgcreate/live.py |   28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

New commits:
commit 8041f10645981473d111f9295f0d49d4a43e9327
Author: Brian C. Lane <bcl at redhat.com>
Date:   Thu Mar 31 11:51:46 2011 -0700

    Copy old initrd/xen files to isolinux when using base-on (#690940)
    
    These are not present in the original .iso's /boot so copy them
    over to the new /isolinux
    
    This could fail with mismatched files if the kernels change, in that
    case a new .iso needs to be made instead of using base-on

diff --git a/imgcreate/live.py b/imgcreate/live.py
index a15eb72..655eb16 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -22,6 +22,7 @@ import glob
 import shutil
 import subprocess
 import logging
+import re
 
 from imgcreate.errors import *
 from imgcreate.fs import *
@@ -79,6 +80,7 @@ class LiveImageCreatorBase(LoopImageCreator):
         self.__modules.extend(kickstart.get_modules(self.ks))
 
         self._isofstype = "iso9660"
+        self.base_on = False
 
     #
     # Hooks for subclasses
@@ -149,12 +151,24 @@ class LiveImageCreatorBase(LoopImageCreator):
             raise CreatorError("Failed to loopback mount '%s' : %s" %
                                (base_on, e))
 
+        # Copy the initrd%d.img and xen%d.gz files over to /isolinux
+        # This is because the originals in /boot are removed when the
+        # original .iso was created.
+        src = isoloop.mountdir + "/isolinux/"
+        dest = self.__ensure_isodir() + "/isolinux/"
+        makedirs(dest)
+        pattern = re.compile(r"(initrd\d+\.img|xen\d+\.gz)")
+        files = [f for f in os.listdir(src) if pattern.search(f)
+                                               and os.path.isfile(src+f)]
+        for f in files:
+            shutil.copyfile(src+f, dest+f)
+
         # legacy LiveOS filesystem layout support, remove for F9 or F10
         if os.path.exists(isoloop.mountdir + "/squashfs.img"):
             squashimg = isoloop.mountdir + "/squashfs.img"
         else:
             squashimg = isoloop.mountdir + "/LiveOS/squashfs.img"
-            
+
         squashloop = DiskMount(LoopbackDisk(squashimg, 0), self._mkdtemp(), "squashfs")
 
         # 'self.compress_type = None' will force reading it from base_on.
@@ -194,6 +208,7 @@ class LiveImageCreatorBase(LoopImageCreator):
             isoloop.cleanup()
 
     def _mount_instroot(self, base_on = None):
+        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")
@@ -410,9 +425,11 @@ class x86LiveImageCreator(LiveImageCreatorBase):
             shutil.copyfile(bootdir + "/initramfs-" + version + ".img",
                             isodir + "/isolinux/initrd" + index + ".img")
             isDracut = True
-        else:
+        elif os.path.exists(bootdir + "/initrd-" + version + ".img"):
             shutil.copyfile(bootdir + "/initrd-" + version + ".img",
                             isodir + "/isolinux/initrd" + index + ".img")
+        elif not self.base_on:
+            logging.error("No initrd or initramfs found for %s" % (version,))
 
         is_xen = False
         if os.path.exists(bootdir + "/xen.gz-" + version[:-3]):


commit 0d3136dcaa62c85778ca5759e2580a48fc464c79
Author: Brian C. Lane <bcl at redhat.com>
Date:   Wed Mar 30 16:31:27 2011 -0700

    Don't fail on missing splash image
    
    The splash image is provided by the logo package.
    It shouldn't be a fatal error if it is missing.

diff --git a/imgcreate/live.py b/imgcreate/live.py
index 10d5cec..a15eb72 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -605,8 +605,11 @@ menu hiddenrow 5
             return False
         shutil.copy(self._instroot + "/boot/efi/EFI/redhat/grub.efi",
                     isodir + "/EFI/boot/grub.efi")
-        shutil.copy(self._instroot + "/boot/grub/splash.xpm.gz",
-                    isodir + "/EFI/boot/splash.xpm.gz")
+
+        # 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")
 
         return True
 




More information about the livecd mailing list