|
|
|
@ -54,8 +54,8 @@ from cl_template import template
|
|
|
|
|
from cl_datavars import DataVars
|
|
|
|
|
from cl_print import color_print
|
|
|
|
|
from cl_distr import PartitionDistributive,DistributiveRepository,\
|
|
|
|
|
DistributiveError, ScratchDistributive, MultiPartitions, \
|
|
|
|
|
Spinner
|
|
|
|
|
DistributiveError, ScratchPartitionDistributive, \
|
|
|
|
|
MultiPartitions, Spinner
|
|
|
|
|
from cl_string import tableReport
|
|
|
|
|
from time import sleep
|
|
|
|
|
from subprocess import PIPE,STDOUT
|
|
|
|
@ -726,12 +726,13 @@ class cl_install(color_print):
|
|
|
|
|
self.installBootloader(targetDistr)
|
|
|
|
|
|
|
|
|
|
def getTargetDistributive(self,disk,fileSystem="reiserfs",isFormat=False,
|
|
|
|
|
systemId=None):
|
|
|
|
|
#if buildermode:
|
|
|
|
|
#return ScratchDistributive(disk,mdirectory="/mnt/install",
|
|
|
|
|
#check=True)
|
|
|
|
|
#else:
|
|
|
|
|
return PartitionDistributive(disk,mdirectory="/mnt/install",
|
|
|
|
|
systemId=None,buildermode=False):
|
|
|
|
|
if buildermode:
|
|
|
|
|
return ScratchPartitionDistributive(disk,mdirectory="/mnt/install",
|
|
|
|
|
check=True, fileSystem=fileSystem,
|
|
|
|
|
isFormat=isFormat, systemId=systemId)
|
|
|
|
|
else:
|
|
|
|
|
return PartitionDistributive(disk,mdirectory="/mnt/install",
|
|
|
|
|
check=True, fileSystem=fileSystem,
|
|
|
|
|
isFormat=isFormat, systemId=systemId)
|
|
|
|
|
|
|
|
|
@ -746,19 +747,6 @@ class cl_install(color_print):
|
|
|
|
|
else:
|
|
|
|
|
return dirsFiles
|
|
|
|
|
|
|
|
|
|
def _getTransferedBind(self,skipSrc,skipDest):
|
|
|
|
|
def list2binddict(l):
|
|
|
|
|
return {'srcMountPoint':l[0],
|
|
|
|
|
'isFormat':False,
|
|
|
|
|
'destMountPoint':l[1],
|
|
|
|
|
'options':['bind'],
|
|
|
|
|
'fileSystem':'none'}
|
|
|
|
|
return map(list2binddict,
|
|
|
|
|
filter(lambda x: not x[0] in skipSrc and
|
|
|
|
|
not x[1] in skipDest,
|
|
|
|
|
zip(self.clVars.Get('os_install_bind_dir'),
|
|
|
|
|
self.clVars.Get('os_install_bind_mountpoint'))))
|
|
|
|
|
|
|
|
|
|
def setInstallOptions(self, listDisks, listBinds, listSwaps, listUsers,
|
|
|
|
|
mbrDisk):
|
|
|
|
|
"""Set data for installation partitions"""
|
|
|
|
@ -787,11 +775,18 @@ class cl_install(color_print):
|
|
|
|
|
self.printWARNING(_("See 'man mount' for file system") + " "+\
|
|
|
|
|
", ".join(convObj.listFileSystemCorrupted))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
usedDevicesOnlyDisks = map(lambda x:x['dev'],listDisks)
|
|
|
|
|
usedDevicesOnlySwap = map(lambda x:x['dev'],listSwaps)
|
|
|
|
|
usedDevices = map(lambda x:x['dev'],listSwaps)+usedDevicesOnlyDisks
|
|
|
|
|
usedMP = map(lambda x:x['mountPoint'],listDisks) + \
|
|
|
|
|
map(lambda x:x['destMountPoint'],listBinds)
|
|
|
|
|
if self.clVars.Get('os_install_scratch') == "on" and \
|
|
|
|
|
filter(lambda x: x != '/', usedMP):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Builder mode is not support multipartition"))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
# check specified devices
|
|
|
|
|
wrongDevices = list(set(usedDevicesOnlyDisks) - \
|
|
|
|
|
set(self.clVars.Get('os_disk_dev')))
|
|
|
|
@ -848,20 +843,29 @@ class cl_install(color_print):
|
|
|
|
|
self.printERROR(_("Device '%s' is used twice")%dupDevices[0])
|
|
|
|
|
return False
|
|
|
|
|
# detect duplicate mount points
|
|
|
|
|
dupMP = list(set(filter(lambda x:usedMP.count(x)>1,
|
|
|
|
|
dupMP = list(set(filter(lambda x:usedMP.count(x)>1 and x != "none",
|
|
|
|
|
usedMP)))
|
|
|
|
|
if dupMP:
|
|
|
|
|
self.printERROR(_("Mount point '%s' is used twice")%dupMP[0])
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
clearSwap = lambda data,isswap: data if len(listSwaps) == 0 or \
|
|
|
|
|
isswap != "swap" else ""
|
|
|
|
|
def clearParam(data,isswap):
|
|
|
|
|
if builderMode:
|
|
|
|
|
if len(listSwaps) == 0 and isswap == "swap":
|
|
|
|
|
return data
|
|
|
|
|
else:
|
|
|
|
|
if len(listSwaps) == 0 or isswap != "swap":
|
|
|
|
|
return data
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
builderMode = self.clVars.Get('os_install_scratch') == "on"
|
|
|
|
|
clearBuilder = lambda data,isswap: "" if builderMode and isswap != "swap" else data
|
|
|
|
|
# get hash from current variables
|
|
|
|
|
devMount = dict(map(lambda x:(x[0],
|
|
|
|
|
{'mountPoint':clearSwap(x[1],x[1]),
|
|
|
|
|
'fileSystem':x[2],
|
|
|
|
|
'options':clearSwap(x[3],x[1]),
|
|
|
|
|
'isFormat':""}),
|
|
|
|
|
{'mountPoint':clearParam(x[1],x[1]),
|
|
|
|
|
'fileSystem':x[2],
|
|
|
|
|
'options':clearParam(x[3],x[1]),
|
|
|
|
|
'isFormat':""}),
|
|
|
|
|
zip(self.clVars.Get('os_disk_dev'),
|
|
|
|
|
self.clVars.Get('os_install_disk_mount'),
|
|
|
|
|
self.clVars.Get('os_install_disk_format'),
|
|
|
|
@ -893,10 +897,14 @@ class cl_install(color_print):
|
|
|
|
|
if isFormat:
|
|
|
|
|
devMount[dev]['isFormat'] = "yes"
|
|
|
|
|
|
|
|
|
|
bindDestSrc = dict(zip(self.clVars.Get('os_install_bind_mountpoint'),
|
|
|
|
|
self.clVars.Get('os_install_bind_dir')))
|
|
|
|
|
bindSrcDest = dict(zip(self.clVars.Get('os_install_bind_dir'),
|
|
|
|
|
self.clVars.Get('os_install_bind_mountpoint')))
|
|
|
|
|
if builderMode:
|
|
|
|
|
bindDestSrc = {}
|
|
|
|
|
bindSrcDest = {}
|
|
|
|
|
else:
|
|
|
|
|
bindDestSrc =dict(zip(self.clVars.Get('os_install_bind_mountpoint'),
|
|
|
|
|
self.clVars.Get('os_install_bind_dir')))
|
|
|
|
|
bindSrcDest = dict(zip(self.clVars.Get('os_install_bind_dir'),
|
|
|
|
|
self.clVars.Get('os_install_bind_mountpoint')))
|
|
|
|
|
|
|
|
|
|
for bindData in listBinds:
|
|
|
|
|
srcMountPoint = bindData['srcMountPoint']
|
|
|
|
@ -979,6 +987,7 @@ class cl_install(color_print):
|
|
|
|
|
disk['systemId'] = updateIdDict[disk['dev']]
|
|
|
|
|
else:
|
|
|
|
|
disk['systemId'] = None
|
|
|
|
|
|
|
|
|
|
# use or not MBR
|
|
|
|
|
bootDiskGrub = ""
|
|
|
|
|
if mbrDisk == "off":
|
|
|
|
@ -1305,7 +1314,8 @@ class cl_install(color_print):
|
|
|
|
|
'boot',self.clVars.Get('os_install_initrd'))
|
|
|
|
|
return InitRamFs(initrdPath).cleanInitRamFs()
|
|
|
|
|
|
|
|
|
|
def installSystem(self, force=False, bootDisk=None, stdinReadPwd=False):
|
|
|
|
|
def installSystem(self, force=False, bootDisk=None, stdinReadPwd=False,
|
|
|
|
|
builder=False):
|
|
|
|
|
"""install System by current variable enviroment"""
|
|
|
|
|
sourceDistr = None
|
|
|
|
|
targetDistr = None
|
|
|
|
@ -1337,6 +1347,7 @@ class cl_install(color_print):
|
|
|
|
|
#%waittime)
|
|
|
|
|
self.printInfo(sourceDistr,targetDistr)
|
|
|
|
|
targetDistr = self.getTargetDistributive(rootPartdev,
|
|
|
|
|
buildermode=builder,
|
|
|
|
|
fileSystem=rootPartFileSystem,
|
|
|
|
|
isFormat=rootPartIsFormat,
|
|
|
|
|
systemId=rootPartSystemId)
|
|
|
|
@ -1430,6 +1441,10 @@ the system") + " (yes/no)"
|
|
|
|
|
targetDistr.installFrom(sourceDistr)
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
|
|
|
|
|
# optimize initrd
|
|
|
|
|
self.printMessageForTest(_("Creating new initrd file"))
|
|
|
|
|
self.printByResult(self.cleanInitrd())
|
|
|
|
|
|
|
|
|
|
# copy clt files from current system
|
|
|
|
|
self.printMessageForTest(_("Coping clt templates to new system"))
|
|
|
|
|
cltCpy = cltCopy(target=targetDistr.getDirectory())
|
|
|
|
@ -1440,10 +1455,12 @@ the system") + " (yes/no)"
|
|
|
|
|
self.printMessageForTest(_("Updating config"))
|
|
|
|
|
self.applyTemplates(targetDistr.getDirectory())
|
|
|
|
|
# mount bind mount points
|
|
|
|
|
targetDistr.postinstallMountBind()
|
|
|
|
|
|
|
|
|
|
self.writeInstallVars()
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
self.printMessageForTest(_("Post-install configuration"))
|
|
|
|
|
targetDistr.postinstallMountBind()
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
|
|
|
|
|
# migrate users
|
|
|
|
|
self.printSUCCESS(_("Migrate users"))
|
|
|
|
@ -1455,9 +1472,6 @@ the system") + " (yes/no)"
|
|
|
|
|
self.printMessageForTest(_("Preparing system for reboot"))
|
|
|
|
|
self.prepareBoot(targetDistr)
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
# optimize initrd
|
|
|
|
|
self.printMessageForTest(_("Creating new initrd file"))
|
|
|
|
|
self.printByResult(self.cleanInitrd())
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
except (EOFError), e:
|
|
|
|
|