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
From: "Brian C. Lane" bcl@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)
Neat!
Added label: ACK.
Seems ok to me too :+1:
Closed.
pushed
Do we know that our image indices match grub's? I would have loved to do it this way when I wrote bootloader.py, but I think it's impossible to know how grub2-mkconfig will order things -- especially when multi-boot is involved.
anaconda-patches@lists.fedorahosted.org