Removed template function grub()

develop
Самоукин Алексей 14 years ago
parent 2b131b0a0b
commit 3087eb8693

@ -3096,40 +3096,6 @@ os_disk_install not found mount point '\' and '\%s'")%mountPoint)
textTemplateTmp[resS.end():]
return textTemplateTmp
def funcGrub(self, funArgv, resS, localVars, textTemplateTmp):
"""Функция шаблона grub().
Выдает незакоментированные разделы установки из файла /boot/grub.conf
Удаляет из выдачи строки относящиеся к разделу в который устанавливается
система
Используется при генерации файла grub.conf в новой системе
"""
terms = funArgv.replace(" ","").split(",")
if len(terms) != 1:
self.printErrTemplate()
cl_overriding.exit(1)
funcPkg = terms[0]
if funcPkg:
cl_overriding.printERROR(_("incorrect template path"))
self.printErrTemplate()
cl_overriding.exit(1)
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
def printErrTemplate(self):
"""Печать ошибки при обработке функций шаблона"""
cl_overriding.printERROR(_("error in template %s")%self.nameTemplate)

Loading…
Cancel
Save