Fix update grub2 config.

Mike Hiretsky 13 years ago
parent 80570199c2
commit 6793147086

@ -23,9 +23,11 @@ from os import path
from cl_builder import DataVarsBuilder, printNoColor, __version__, __app__
from cl_utils import process,listDirectory,cmpVersion,reVerSplitToPV, \
reVerSplit
from cl_vars_share import varsShare
from subprocess import STDOUT,PIPE
from cl_print import color_print
from shutil import copy2 as copy_with_perm
from cl_apply_template import updateConfFiles
from cl_kernel_utils import KernelConfig,InitRamFs
@ -354,6 +356,7 @@ class cl_kernel(color_print):
clKernelUid = clVars.Get('cl_kernel_uid')
clVars.Write('cl_kernel_uid',clKernelUid,force=True)
grubconf = '/boot/grub/grub.conf'
grub2conf = '/boot/grub/grub.cfg'
rootdev = clVars.Get('os_root_dev')
x11video = clVars.Get('os_x11_video_drv')
@ -381,6 +384,16 @@ class cl_kernel(color_print):
change = lambda self,y:self.reChangeCalculate.sub(
' calculate=video:%s'%x11video,y,1)
# if has grub2
if filter(lambda x:x.startswith("grub-1.99"),
listDirectory('/var/db/pkg/sys-boot')):
clTemplate = updateConfFiles()
clTemplate.applyAllTemplates(package="grub")
if not filter(lambda x:x.startswith("grub-0.9"),
listDirectory('/var/db/pkg/sys-boot')) or not path.exists(grubconf):
return True
if not os.access(grubconf,os.W_OK):
self.printERROR(_("No permissions to write to '%s'")%grubconf)
return False

Loading…
Cancel
Save