|
|
|
@ -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
|
|
|
|
|