Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use the index in grubenv (#1209678)
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
(cherry picked from commit 15338de)
  • Loading branch information
bcl committed Jun 24, 2015
1 parent 111a7d4 commit 8e65013
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pyanaconda/bootloader.py
Expand Up @@ -1584,8 +1584,14 @@ def write_config(self):

# make sure the default entry is the OS we are installing
if self.default is not None:
entry_title = "0"
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)

Expand Down

0 comments on commit 8e65013

Please sign in to comment.