---
snake/install.py | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/snake/install.py b/snake/install.py
index 8c1a5f0..6be4edb 100644
--- a/snake/install.py
+++ b/snake/install.py
@@ -26,14 +26,30 @@ from rhpl.translate import _
from urlgrabber import grabber
# FIXME this needs to support various arches
-def grubby(kernel,initrd,args='',title='snake'):
+def grubby(kernel, initrd, args='', title='snake', arch=None,
progresscb=None):
'''Uses grubby to modify the bootloader config to make the given kernel
and initrd the default bootloader choice. Uses 'snake' for the title if one
is not given.'''
+
+ if progresscb:
+ progresscb.start(text=_("Updating bootloader"), size=2)
+ progresscb.update(0)
+
# FIXME check to see if 'snake' already exists and add a suffix if needed
cmd="""/sbin/grubby --make-default --title='%s'
--add-kernel=%s --initrd=%s --args='%s'""" %
(title,kernel,initrd,args)
- return os.system(cmd)
- # FIXME need to run ybin here on yaboot (Apple) machines
+ rc = os.system(cmd)
+ if progresscb: progresscb.update(1)
+
+ if arch.startswith("ppc"):
+ rc = os.system("/sbin/ybin")
+ elif arch.startswith("s390"):
+ rc = os.system("/sbin/zipl")
+
+ if progresscb:
+ progresscb.update(2)
+ progresscb.end(2)
+
+ return rc
def __file_write(inf,outf,blocksize=4096):
'''Write the contents of inf to outf'''
@@ -55,6 +71,7 @@ def add_file_to_initrd(addfile,initrd,outfile=None,progresscb=None):
in usr/share on the initrd, it needs to be in usr/share/foo locally.'''
if progresscb: progresscb.start(text=_("Building initrd"), size=6)
+ if progresscb: progresscb.update(0)
# Create temporary file
(fd,tmpinitrd) = tempfile.mkstemp('.cpio')
@@ -97,6 +114,7 @@ def add_file_to_initrd(addfile,initrd,outfile=None,progresscb=None):
os.rmdir(tmpext2fs)
os.unlink(tmpinitrd)
+ if progresscb: progresscb.update(6)
if progresscb: progresscb.end(6)
return True
@@ -223,7 +241,7 @@ def fetch_and_prep(uri,**kwargs):
else:
args = args + " method=%s" % uri
- snake.install.grubby(kernel,initrd,args,"install %s" % str(tree))
+ snake.install.grubby(kernel, initrd, args, title="install %s" %
str(tree), arch=arch, progresscb=progresscb)
finally:
fetcher.cleanupLocation()
--
1.5.4.5