26 Jun 2012 03:31
[PATCH] boottool: Search for installed grub in the system
Lucas Meneghel Rodrigues <lmr <at> redhat.com>
2012-06-26 01:31:46 GMT
2012-06-26 01:31:46 GMT
Current boottool assumes a hardcoded path for grub,
/sbin/grub. Distros such as OpenSUSE install it on
/usr/sbin/grub, so this will cause a grub setup to
flat out fail on those distros.
So let's leverage find_executable, that is already
present, to take care of actually finding the
appropriate grub path.
Signed-off-by: Lucas Meneghel Rodrigues <lmr <at> redhat.com>
---
client/tools/boottool | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/client/tools/boottool b/client/tools/boottool
index 794377b..53f7d94 100755
--- a/client/tools/boottool
+++ b/client/tools/boottool
<at> <at> -1401,13 +1401,16 <at> <at> class Grubby(object):
grub_instructions = ['savedefault --default=%s --once' % entry_index,
'quit']
grub_instructions_text = '\n'.join(grub_instructions)
- grub_binary = '/sbin/grub'
+ grub_binary = find_executable('grub')
+ if grub_binary is None:
+ self.log.error("Could not find the 'grub' binary, aborting")
+ return -1
p = subprocess.Popen([grub_binary, '--batch'],
stdin=subprocess.PIPE,
(Continue reading)
RSS Feed