Fix transfer entry from grub.

netsetup
Mike Hiretsky 14 years ago
parent 37821912d0
commit 35b3c8c34e

@ -1021,16 +1021,26 @@ class fillVars(object, glob_attr):
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 )
reRemoveComments = re.compile("(^|\n)[\t ]*#[^\n]*?(?=\n|$)", re.S)
reGrubEntry = re.compile("(title.*?)(?=title|$)", re.S | re.I )
reRootEntry = re.compile("root=(\S+)")
grubconf = reRemoveComments.sub("",open(pathGrubConf,'r').read())
roothd = filter(lambda x: x[1] == '/',
zip(self.Get('os_disk_dev'),
self.Get('os_install_disk_mount')))
self.Get('os_install_disk_mount'),
self.Get('os_disk_uuid')))
if roothd:
roothd = "root=%s" % roothd[0][0]
return ("".join(filter(lambda x: not roothd in x,
reGrubEntry.findall(grubconf)))).strip()
transRoot = \
filter(lambda x:x != roothd[0][0] and \
x != "UUID=%s"%roothd[0][2],
self.Get('os_disk_dev')+
map(lambda x:"UUID=%s"%x,
filter(lambda x:x,self.Get('os_disk_uuid'))))
return ("".join(
map(lambda x:x[0],
filter(lambda x:not x[1] or x[1].groups()[0] in transRoot,
map(lambda x:(x,reRootEntry.search(x)),
reGrubEntry.findall(grubconf)))))).strip()
return ""
def get_cl_migrate_user(self):

Loading…
Cancel
Save