Add using cl_install_root_from

master3.3
Mike Hiretsky 14 years ago
parent 774f522e07
commit 9c4050de12

@ -782,8 +782,14 @@ class fillVars(object, glob_attr):
return self.Get('os_root_type')
def get_os_install_dev_from(self):
if self.Get('os_root_type') == "hdd":
return self.Get('os_root_dev')
"""Detect previous system"""
calculate1ini = "/etc/calculate/calculate.ini"
calculate1param = "install.devfrom"
if pathexists(calculate1ini):
return reduce(lambda x,y: [y.rpartition('=')[2].strip()],
filter(lambda x: x.partition("=")[0] == calculate1param,
open(calculate1ini,"r")),
None)
else:
return ""
@ -885,12 +891,10 @@ class fillVars(object, glob_attr):
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')))
zip(self.Get('os_disk_dev'),
self.Get('os_install_disk_mount')))
if roothd:
roothd = "root=%s" % roothd[0][0]
replace = ("".join(filter(lambda x: not roothd in x,
return ("".join(filter(lambda x: not roothd in x,
reGrubEntry.findall(grubconf)))).strip()
textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\
textTemplateTmp[resS.end():]
return textTemplateTmp
return ""

@ -753,7 +753,7 @@ class cl_install(color_print):
listDisks = map(convObj, listDisks)
# detect previous system if not specified root partition
if not filter(lambda x: x['mountPoint'] == '/',listDisks):
prevRootDev = self.detectPreviousSystem()
prevRootDev = self.clVars.Get('os_install_dev_from')
if prevRootDev:
listDisks += map(convObj, [{'mountPoint': '',
'options': [],
@ -1041,16 +1041,6 @@ class cl_install(color_print):
else:
return ""
def detectPreviousSystem(self):
"""Detect previous system"""
calculate1ini = "/etc/calculate/calculate.ini"
calculate1param = "install.devfrom"
if pathexists(calculate1ini):
return reduce(lambda x,y: [y.rpartition('=')[2].strip()],
filter(lambda x: x.partition("=")[0] == calculate1param,
open(calculate1ini,"r")),
None)
def installBootloader(self,target, grubDisk="0"):
"""Install boot loader
@ -1244,8 +1234,11 @@ class cl_install(color_print):
return True
def writeInstallVars(self):
if not self.clVars.WriteVars(header="install"):
raise InstallError(self.getError())
if self.Get('os_root_type') == 'hdd':
self.clVars.Write("os_install_dev_from",
self.clVars.Get('os_root_dev'), header="install")
#if not self.clVars.WriteVars(header="install"):
# raise InstallError(self.getError())
def installSystem(self, force=False, bootDisk=None, users=[]):
"""install System by current variable enviroment"""
@ -1370,7 +1363,7 @@ the system") + " (yes/no)"
# install distributive
self.printSUCCESS(
_("Unpacking system image into target")+" ... ",printBR=False)
self.clVars('os_grub_conf')
self.clVars.Get('os_grub_conf')
targetDistr.installFrom(sourceDistr)
self.printSUCCESS("Unpacking complete")

Loading…
Cancel
Save