Commits

Moises Henriquez  committed 3f65c65

Debug path to initrd

  • Participants
  • Parent commits ba7a6bd

Comments (0)

Files changed (1)

File vinstall/backend/bootloader.py

             root, long_desc, short_desc, os_type = \
                     [ s.strip() for s in i.split(":") ]
             operating_system = cls()
+            operating_system.initrd = None
 	    LOG.debug("Found %s on %s"% (os_type, root))
             if short_desc.startswith("Vector"):
                 short_desc = "VectorLinux - %s"% root.split("/")[-1]
     line = line.strip()
     root, boot, _, kernel, initrd, append = \
             [ i.strip() for i in line.split(":") ]
-    return dict(root=root, kernel=kernel, initrd=initrd, append=append)
+    #XX: linux-boot-prober is reporting hits and misses for some of these
+    #XX: boot parameters.  Lets verify that the kernel and initrd are correct
+    p = media.Partition(root_partition)
+    umount = False
+    if not p.is_mounted():
+        mountpoint = p.mount(p.mountpoint)
+        umount = True
+    else:
+        mountpoint = p.mountpoint
+    if not os.path.exists(mountpoint + initrd):
+        LOG.debug("linux-boot-prober gave me a bad path for initrd!!!.  Trying to find a good one")
+        initrd = "" #: Should we use None here?
+        ramdisks = ("boot/initrd","boot/initrd.gz","initrd","initrd.img",
+                    "boot/initrd.img")
+        for rd in ramdisks:
+            if os.path.exists(os.path.join(mountpoint, rd)):
+                initrd = os.path.join("/",rd)
+                LOG.debug("Located correct path to initrd %s"% initrd)
+                break
+    else:
+        LOG.debug("Path to initrd for os on %s verified"% root_partition)
 
+    if umount:
+        p.umount()
+        
+    res = dict(root=root, kernel=kernel, initrd=initrd, append=append)
+    LOG.debug("Found linux boot data for %s"% root_partition)
+    LOG.debug(res)
+    return res
 
 class FakeDeviceTestCase(unittest.TestCase):