[rhel7-branch 1/1] Use the index in grubenv (#1209678)

bcl installerbot-noreply at redhat.com
Fri Jun 19 21:57:00 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

Trying to exactly match the name that grub2 uses for the menutitle is
easier to do using index instead of trying to reconstruct the title
name.

Resolves: rhbz#1209678
---
 pyanaconda/bootloader.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 999c29d..d15a44e 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1552,9 +1552,14 @@ def write_config(self):
 
         # make sure the default entry is the OS we are installing
         if self.default is not None:
-            entry_title = "%s Linux, with Linux %s" % (productName,
-                                                       self.default.version)
-            rc = iutil.execInSysroot("grub2-set-default", [entry_title])
+            # find the index of the default image
+            try:
+                default_index = self.images.index(self.default)
+            except ValueError:
+                log.warn("Failed to find default image (%s), defaulting to 0", self.default.label)
+                default_index = 0
+
+            rc = iutil.execInSysroot("grub2-set-default", [str(default_index)])
             if rc:
                 log.error("failed to set default menu entry to %s", productName)
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/3fd9954ae9e842cb0ab860a26e0867d2e113db0e


More information about the anaconda-patches mailing list