Skip to content

Commit

Permalink
Merge pull request #969 from nacc/boottool_grub2
Browse files Browse the repository at this point in the history
boottool: sles12 and rhel7 on power use /boot/grub2/grub.cfg
  • Loading branch information
lmr committed Sep 9, 2015
2 parents 00d7bc6 + 76d21c0 commit e614c82
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions client/tools/boottool.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import tempfile
import shutil
import struct
import platform

#
# Get rid of DeprecationWarning messages on newer Python version while still
Expand Down Expand Up @@ -861,6 +862,15 @@ def _set_bootloader(self, bootloader=None):
raise ValueError('Bootloader "%s" is not supported' %
bootloader)

def _dist_uses_grub2(self):
if self.get_architecture().startswith('ppc64'):
(d_name, d_version, d_id) = platform.dist()
if d_name.lower() == 'redhat' and d_version >= 7:
return True
if d_name.lower() == 'suse' and d_version >= 12:
return True
return False

def _run_grubby_prepare_args(self, arguments, include_bootloader=True):
'''
Prepares the argument list when running a grubby command
Expand All @@ -886,6 +896,8 @@ def _run_grubby_prepare_args(self, arguments, include_bootloader=True):
# Override configuration file
if self.opts is not None and self.opts.config_file:
args.append('--config-file=%s' % self.opts.config_file)
elif self._dist_uses_grub2():
args.append('--config-file=/boot/grub2/grub.cfg')

args += arguments
return args
Expand Down Expand Up @@ -1666,6 +1678,8 @@ def boot_once_grub2(self, entry_index):
# Make sure the "set default" entry in the configuration file is set
# to "${saved_entry}. Assuming the config file is at /boot/grub/grub.cfg
deb_grub_cfg_path = '/boot/grub/grub.cfg'
if self._dist_uses_grub2():
deb_grub_cfg_path = '/boot/grub2/grub.cfg'
deb_grub_cfg_bkp_path = '%s.boottool.bak' % deb_grub_cfg_path

default_index = None
Expand Down

0 comments on commit e614c82

Please sign in to comment.