[PATCH 2/3] add rescue kernel entry to extlinux conf

Gene Czarcinski gene at czarc.net
Tue Apr 22 16:33:05 UTC 2014


This update adds an additional kernel definition to extlinux.conf
which points to the rescue kernel installed by anaconda.
---
 pyanaconda/bootloader.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 6012d3a..f8d8220 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2224,6 +2224,27 @@ class EXTLINUX(BootLoader):
                          "boot_prefix": self.boot_prefix})
             config.write(stanza)
 
+        # create an entry with the rescue kernel
+        machid_path = os.path.normpath(ROOT_PATH + "/etc/machine-id")
+        machid_file = open(machid_path, "r")
+        machid = machid_file.readline()
+        machid_file.close()
+        machid = machid.split()[0]
+        rescue_version  = "0-rescue-" + machid
+        rescue_kernel = "vmlinuz-0-rescue-" + machid
+        rescue_initrd = "initramfs-0-rescue-" + machid + ".img"
+        rescue_stanza = ("label %(label)s %(version)s\n"
+                  "\tkernel %(boot_prefix)s/%(kernel)s\n"
+                  "\tinitrd %(boot_prefix)s/%(initrd)s\n"
+                  "\tappend %(args)s\n\n"
+                  % {"label": self.image_label(image),
+                     "version": rescue_version,
+                     "kernel": rescue_kernel,
+                     "initrd": rescue_initrd,
+                     "args": args,
+                     "boot_prefix": self.boot_prefix})
+        config.write(rescue_stanza)
+
     def write_config_header(self, config):
         header = ("# extlinux.conf generated by anaconda\n\n"
                   "ui menu.c32\n\n"
-- 
1.9.0



More information about the anaconda-patches mailing list