Fix getting grub for newsystem in multipartition

netsetup
Mike Hiretsky 14 years ago
parent 4ab9852aba
commit e734337893

@ -876,3 +876,21 @@ class fillVars(object, glob_attr):
def get_os_install_initrd_install(self):
return self.getInitrd(suffix="install")
def get_os_grub_conf(self):
"""Use for generate grub.conf for new system"""
pathGrubConf = "/boot/grub/grub.conf"
replace = ""
if os.access(pathGrubConf,os.R_OK):
reRemoveComments = re.compile("(^|\n)\s*#[^\n]*?(?=\n|$)", re.S)
reGrubEntry = re.compile("title.*?(?=title|$)", re.S | re.I )
grubconf = reRemoveComments.sub("",open(pathGrubConf,'r').read())
roothd = filter(lambda x: x[1] == '/',
zip(self.objVar.Get('os_disk_dev'),
self.objVar.Get('os_install_disk_mount')))
if roothd:
roothd = "root=%s" % roothd[0][0]
replace = ("".join(filter(lambda x: not roothd in x,
reGrubEntry.findall(grubconf)))).strip()
textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\
textTemplateTmp[resS.end():]
return textTemplateTmp

@ -1370,6 +1370,7 @@ the system") + " (yes/no)"
# install distributive
self.printSUCCESS(
_("Unpacking system image into target")+" ... ",printBR=False)
self.clVars('os_grub_conf')
targetDistr.installFrom(sourceDistr)
self.printSUCCESS("Unpacking complete")

@ -261,3 +261,6 @@ class Data:
# install initramfs filename
os_install_initrd_install = {}
# current grub
os_grub_conf = {}

Loading…
Cancel
Save