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') return self.Get('os_root_type')
def get_os_install_dev_from(self): def get_os_install_dev_from(self):
if self.Get('os_root_type') == "hdd": """Detect previous system"""
return self.Get('os_root_dev') 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: else:
return "" return ""
@ -885,12 +891,10 @@ class fillVars(object, glob_attr):
reGrubEntry = re.compile("title.*?(?=title|$)", re.S | re.I ) reGrubEntry = re.compile("title.*?(?=title|$)", re.S | re.I )
grubconf = reRemoveComments.sub("",open(pathGrubConf,'r').read()) grubconf = reRemoveComments.sub("",open(pathGrubConf,'r').read())
roothd = filter(lambda x: x[1] == '/', roothd = filter(lambda x: x[1] == '/',
zip(self.objVar.Get('os_disk_dev'), zip(self.Get('os_disk_dev'),
self.objVar.Get('os_install_disk_mount'))) self.Get('os_install_disk_mount')))
if roothd: if roothd:
roothd = "root=%s" % roothd[0][0] 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() reGrubEntry.findall(grubconf)))).strip()
textTemplateTmp = textTemplateTmp[:resS.start()] + replace +\ return ""
textTemplateTmp[resS.end():]
return textTemplateTmp

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

Loading…
Cancel
Save