|
|
|
@ -747,15 +747,8 @@ class cl_install(color_print):
|
|
|
|
|
else:
|
|
|
|
|
return dirsFiles
|
|
|
|
|
|
|
|
|
|
def setInstallOptions(self, listDisks, listBinds, listSwaps, listUsers,
|
|
|
|
|
mbrDisk):
|
|
|
|
|
def setDisks(self,listDisks,listBinds,listSwaps):
|
|
|
|
|
"""Set data for installation partitions"""
|
|
|
|
|
if listUsers:
|
|
|
|
|
migrateUsers = list(set(listUsers))
|
|
|
|
|
migrateUsers.sort()
|
|
|
|
|
migrateUsers = ["root"] + filter(lambda x: x!="root", migrateUsers)
|
|
|
|
|
self.clVars.Set('cl_migrate_user', migrateUsers, force=True)
|
|
|
|
|
|
|
|
|
|
convObj = convertDictOpt(self.clVars)
|
|
|
|
|
try:
|
|
|
|
|
listDisks = map(convObj, listDisks)
|
|
|
|
@ -775,6 +768,9 @@ class cl_install(color_print):
|
|
|
|
|
self.printWARNING(_("See 'man mount' for file system") + " "+\
|
|
|
|
|
", ".join(convObj.listFileSystemCorrupted))
|
|
|
|
|
return False
|
|
|
|
|
# break perform if disk params empty and os_install_dev_from empty
|
|
|
|
|
if not (listDisks or listSwaps or listBinds):
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
usedDevicesOnlyDisks = map(lambda x:x['dev'],listDisks)
|
|
|
|
|
usedDevicesOnlySwap = map(lambda x:x['dev'],listSwaps)
|
|
|
|
@ -823,7 +819,7 @@ class cl_install(color_print):
|
|
|
|
|
x[1] != "none",
|
|
|
|
|
zip(srcMountPoints,destMountPoints))
|
|
|
|
|
if wrongBind:
|
|
|
|
|
self.printERROR(_("Incorrect moint point (bind '%s' to '%s')")%
|
|
|
|
|
self.printERROR(_("Incorrect mount point (bind '%s' to '%s')")%
|
|
|
|
|
(wrongBind[0][0],wrongBind[0][1]))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
@ -833,7 +829,7 @@ class cl_install(color_print):
|
|
|
|
|
filter(lambda x: not x.startswith("/"),
|
|
|
|
|
map(lambda x:x['srcMountPoint'],listBinds))
|
|
|
|
|
if wrongMP:
|
|
|
|
|
self.printERROR(_("Incorrect moint point '%s'")%wrongMP[0])
|
|
|
|
|
self.printERROR(_("Incorrect mount point '%s'")%wrongMP[0])
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
# detect duplicate devices
|
|
|
|
@ -870,6 +866,8 @@ class cl_install(color_print):
|
|
|
|
|
self.clVars.Get('os_install_disk_mount'),
|
|
|
|
|
self.clVars.Get('os_install_disk_format'),
|
|
|
|
|
self.clVars.Get('os_install_disk_options'))))
|
|
|
|
|
curDevMount = dict(zip(self.clVars.Get('os_disk_dev'),
|
|
|
|
|
self.clVars.Get('os_disk_mount')))
|
|
|
|
|
dictMountDev = dict(zip(self.clVars.Get('os_install_disk_mount'),
|
|
|
|
|
self.clVars.Get('os_disk_dev')))
|
|
|
|
|
# update current variable by cmd params
|
|
|
|
@ -882,7 +880,7 @@ class cl_install(color_print):
|
|
|
|
|
isFormat = diskData['isFormat']
|
|
|
|
|
if mountPoint == "none":
|
|
|
|
|
mountPoint = ""
|
|
|
|
|
curMP = devMount[dev]['mountPoint']
|
|
|
|
|
curMP = curDevMount[dev]
|
|
|
|
|
if curMP and ( curMP != mountPoint and isFormat or curMP == '/' ):
|
|
|
|
|
self.printERROR(_("Specified disk '%s' mounted to")\
|
|
|
|
|
%dev + " " + _("'%s' in current system")\
|
|
|
|
@ -948,8 +946,39 @@ class cl_install(color_print):
|
|
|
|
|
self.printERROR(_("Need specify root partition"))
|
|
|
|
|
return False
|
|
|
|
|
self.clVars.Set('os_install_root_dev',rootDev,True)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def setUsers(self,listUsers):
|
|
|
|
|
"""Set users data (migration)"""
|
|
|
|
|
if listUsers:
|
|
|
|
|
migrateUsers = list(set(listUsers))
|
|
|
|
|
migrateUsers.sort()
|
|
|
|
|
migrateUsers = ["root"] + filter(lambda x: x!="root", migrateUsers)
|
|
|
|
|
self.clVars.Set('cl_migrate_user', migrateUsers, force=True)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
# update listDisksOptions, listSwapsOptions and listBindOptions
|
|
|
|
|
def setMBR(self, mbrDisk):
|
|
|
|
|
"""Set mbr by param or get from variables"""
|
|
|
|
|
bootDiskGrub = ""
|
|
|
|
|
if mbrDisk == "off":
|
|
|
|
|
self.clVars.Set('os_install_mbr',"",force=True)
|
|
|
|
|
elif mbrDisk:
|
|
|
|
|
listbootDiskGrub = map(lambda x: x[0],
|
|
|
|
|
filter(lambda x: "/dev/"+x[0]==mbrDisk,
|
|
|
|
|
zip(self.clVars.Get('os_device_dev'),
|
|
|
|
|
self.clVars.Get('os_device_map'))))
|
|
|
|
|
if filter(lambda x: "/dev/%s"%x == mbrDisk,
|
|
|
|
|
self.clVars.Get('os_device_dev')):
|
|
|
|
|
self.clVars.Set('os_install_mbr',mbrDisk.strip('/dev/'),
|
|
|
|
|
force=True)
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Cann't found disk '%s'")%mbrDisk)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def createListOptions(self):
|
|
|
|
|
"""Create listDisksOptions, listSwapsOptions and listBindOptions
|
|
|
|
|
by variables"""
|
|
|
|
|
diskData = zip(self.clVars.Get('os_disk_dev'),
|
|
|
|
|
self.clVars.Get('os_install_disk_mount'),
|
|
|
|
|
self.clVars.Get('os_install_disk_format'),
|
|
|
|
@ -976,6 +1005,7 @@ class cl_install(color_print):
|
|
|
|
|
|
|
|
|
|
self.listBindsOptions = map(listToOptDictBind,bindData)
|
|
|
|
|
|
|
|
|
|
# update system id
|
|
|
|
|
osDiskDevices = self.clVars.Get('os_disk_dev')
|
|
|
|
|
|
|
|
|
|
updateIdDict = dict(map(lambda x:(x[0],x[2]),filter(lambda x:x[1]!=x[2],
|
|
|
|
@ -987,24 +1017,17 @@ class cl_install(color_print):
|
|
|
|
|
disk['systemId'] = updateIdDict[disk['dev']]
|
|
|
|
|
else:
|
|
|
|
|
disk['systemId'] = None
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
# use or not MBR
|
|
|
|
|
bootDiskGrub = ""
|
|
|
|
|
if mbrDisk == "off":
|
|
|
|
|
self.clVars.Set('os_install_mbr',"",force=True)
|
|
|
|
|
elif mbrDisk:
|
|
|
|
|
listbootDiskGrub = map(lambda x: x[0],
|
|
|
|
|
filter(lambda x: "/dev/"+x[0]==mbrDisk,
|
|
|
|
|
zip(self.clVars.Get('os_device_dev'),
|
|
|
|
|
self.clVars.Get('os_device_map'))))
|
|
|
|
|
if filter(lambda x: "/dev/%s"%x == mbrDisk,
|
|
|
|
|
self.clVars.Get('os_device_dev')):
|
|
|
|
|
self.clVars.Set('os_install_mbr',mbrDisk.strip('/dev/'),
|
|
|
|
|
force=True)
|
|
|
|
|
def setInstallOptions(self, listDisks, listBinds, listSwaps, listUsers,
|
|
|
|
|
mbrDisk):
|
|
|
|
|
"""Set install options (set users, disks and mbr"""
|
|
|
|
|
if self.setUsers(listUsers) and \
|
|
|
|
|
self.setDisks(listDisks,listBinds,listSwaps) and \
|
|
|
|
|
self.setMBR(mbrDisk):
|
|
|
|
|
return self.createListOptions()
|
|
|
|
|
else:
|
|
|
|
|
self.printERROR(_("Cann't found disk '%s'")%mbrDisk)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def getDeviceByField(self,field,value, secondPrefix="os_disk"):
|
|
|
|
|
"""Get device by fields (install load format uuid grub part name)"""
|
|
|
|
|