|
|
|
@ -155,11 +155,18 @@ class VariableOsDeviceTable(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get device partition table"""
|
|
|
|
|
autopartition = self.Get('cl_autopartition_scheme')
|
|
|
|
|
autoDevice = self.Get('cl_autopartition_device')
|
|
|
|
|
def getTable(device):
|
|
|
|
|
prop = getUdevDeviceInfo(name=device)
|
|
|
|
|
return prop.get('ID_PART_TABLE_TYPE',
|
|
|
|
|
self.getTableByChild(device))
|
|
|
|
|
return map(getTable,
|
|
|
|
|
def getByAutopartition(device):
|
|
|
|
|
if autopartition and autoDevice == device:
|
|
|
|
|
return self.Get('cl_autopartition_table')
|
|
|
|
|
else:
|
|
|
|
|
return getTable(device)
|
|
|
|
|
return map(getByAutopartition,
|
|
|
|
|
self.Get('os_device_dev'))
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceName(ReadonlyVariable):
|
|
|
|
@ -481,29 +488,48 @@ class VariableOsBindMountpoint(ReadonlyVariable):
|
|
|
|
|
######################################################################
|
|
|
|
|
# Userselect partion parameters
|
|
|
|
|
######################################################################
|
|
|
|
|
class VariableOsLocationData(Variable):
|
|
|
|
|
class LocationVariable:
|
|
|
|
|
"""
|
|
|
|
|
Location variable
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def uncompatible(self):
|
|
|
|
|
"""
|
|
|
|
|
Network setting up unavailable for flash installation
|
|
|
|
|
"""
|
|
|
|
|
if self.Get('cl_autopartition_scheme'):
|
|
|
|
|
return \
|
|
|
|
|
_("Location not available with autopartitioning")
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationData(LocationVariable,Variable):
|
|
|
|
|
"""
|
|
|
|
|
Select installation disk variable
|
|
|
|
|
"""
|
|
|
|
|
type = "table"
|
|
|
|
|
opt = ["--disk","-d"]
|
|
|
|
|
metavalue = 'DISKS'
|
|
|
|
|
help = _("DISK for installation, will be mounted to DIR. "
|
|
|
|
|
"DIR set to 'none' will cancel the mount point "
|
|
|
|
|
"transfer. For creating bind mount point you have "
|
|
|
|
|
"to specify the source directory as DISK")
|
|
|
|
|
label = _("Locations")
|
|
|
|
|
source = ["os_location_source",
|
|
|
|
|
"os_location_dest",
|
|
|
|
|
"os_location_format",
|
|
|
|
|
"os_location_perform_format"]
|
|
|
|
|
"os_location_perform_format",
|
|
|
|
|
"os_location_size"]
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.help = _("DISK for installation, will be mounted to DIR. "
|
|
|
|
|
"DIR set to 'none' will cancel the mount point "
|
|
|
|
|
"transfer. For creating bind mount point you have "
|
|
|
|
|
"to specify the source directory as DISK")
|
|
|
|
|
self.label = _("Locations")
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationSource(Variable):
|
|
|
|
|
class VariableOsLocationSource(LocationVariable,Variable):
|
|
|
|
|
"""
|
|
|
|
|
Source disk or directory
|
|
|
|
|
"""
|
|
|
|
|
type = "choiceedit-list"
|
|
|
|
|
label = _("Disk or directory")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Disk or directory")
|
|
|
|
|
|
|
|
|
|
def availDevs(self):
|
|
|
|
|
"""
|
|
|
|
@ -520,10 +546,39 @@ class VariableOsLocationSource(Variable):
|
|
|
|
|
return self.Get('os_disk_dev')+self.Get('os_bind_path')
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
print "LocationSource"
|
|
|
|
|
if self.Get('cl_autopartition_scheme'):
|
|
|
|
|
print "Scheme"
|
|
|
|
|
print self.Get('cl_autopartition_disk_dev') + \
|
|
|
|
|
self.Get('cl_autopartition_bind_path')
|
|
|
|
|
return self.Get('cl_autopartition_disk_dev') + \
|
|
|
|
|
self.Get('cl_autopartition_bind_path')
|
|
|
|
|
else:
|
|
|
|
|
print "Avail"
|
|
|
|
|
return self.availDevs()
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
return self.availDevs() + [""]
|
|
|
|
|
return self.fixOsDiskDev(self.availDevs()) + [""]
|
|
|
|
|
|
|
|
|
|
def fixOsDiskDev(self,sourcelist=None):
|
|
|
|
|
"""
|
|
|
|
|
Fix os_disk_dev by autopartitions
|
|
|
|
|
"""
|
|
|
|
|
if not sourcelist:
|
|
|
|
|
sourcelist = self.Get('os_disk_dev')
|
|
|
|
|
scheme = self.Get('cl_autopartition_scheme')
|
|
|
|
|
if scheme:
|
|
|
|
|
excludeDisks = self.Select('os_disk_dev',
|
|
|
|
|
where='os_disk_parent',
|
|
|
|
|
eq=self.Get('cl_autopartition_device'))
|
|
|
|
|
appendDisks = self.Get('cl_autopartition_disk_dev')+ \
|
|
|
|
|
self.Get('cl_autopartition_bind_path')
|
|
|
|
|
else:
|
|
|
|
|
excludeDisks = []
|
|
|
|
|
appendDisks = []
|
|
|
|
|
return list((set(sourcelist)
|
|
|
|
|
-set(excludeDisks))
|
|
|
|
|
|set(appendDisks))
|
|
|
|
|
|
|
|
|
|
def check(self,value):
|
|
|
|
|
"""Check set location source"""
|
|
|
|
@ -537,7 +592,7 @@ class VariableOsLocationSource(Variable):
|
|
|
|
|
###########################
|
|
|
|
|
disks = filter(lambda x:x.startswith('/dev/'),value)
|
|
|
|
|
wrongDevices = list(set(disks) - \
|
|
|
|
|
set(self.Get('os_disk_dev')))
|
|
|
|
|
set(self.fixOsDiskDev()))
|
|
|
|
|
if wrongDevices:
|
|
|
|
|
raise VariableError(_("Incorrect device '%s'")%wrongDevices[0])
|
|
|
|
|
wrongSource = filter(lambda x:x and not x.startswith('/'),value)
|
|
|
|
@ -552,14 +607,20 @@ class VariableOsLocationSource(Variable):
|
|
|
|
|
if dupDevices:
|
|
|
|
|
raise VariableError(_("Device '%s' is used twice")%dupDevices[0])
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationDest(Variable):
|
|
|
|
|
class VariableOsLocationDest(LocationVariable,Variable):
|
|
|
|
|
"""
|
|
|
|
|
Desination directory of install disk data
|
|
|
|
|
"""
|
|
|
|
|
type = "choiceedit-list"
|
|
|
|
|
label = _("Mount point")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Mount point")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('cl_autopartition_scheme'):
|
|
|
|
|
return self.Get('cl_autopartition_disk_mount') + \
|
|
|
|
|
self.Get('cl_autopartition_bind_mountpoint')
|
|
|
|
|
else:
|
|
|
|
|
source = self.Get('os_location_source')
|
|
|
|
|
installFrom = self.Get('os_install_dev_from')
|
|
|
|
|
singleDevice = self.Get('os_install_disk_single')
|
|
|
|
@ -702,11 +763,17 @@ class VariableOsLocationDest(Variable):
|
|
|
|
|
typepart=checkType.upper(),
|
|
|
|
|
part=memberData[0][0]))
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationFormat(Variable):
|
|
|
|
|
class VariableOsLocationFormat(LocationVariable,Variable):
|
|
|
|
|
type = "choice-list"
|
|
|
|
|
label = _("File system")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("File system")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('cl_autopartition_scheme'):
|
|
|
|
|
return self.Get('cl_autopartition_disk_format') + \
|
|
|
|
|
map(lambda x:"",self.Get('cl_autopartition_bind_path'))
|
|
|
|
|
else:
|
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
|
value = [""]*len(source)
|
|
|
|
@ -770,11 +837,19 @@ class VariableOsLocationFormat(Variable):
|
|
|
|
|
_("Swap partition {dev} must be formatted as swap").format(
|
|
|
|
|
dev=dev))
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationPerformFormat(Variable):
|
|
|
|
|
class VariableOsLocationPerformFormat(LocationVariable,Variable):
|
|
|
|
|
type = "bool-list"
|
|
|
|
|
label = _("Format")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Format")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('cl_autopartition_scheme'):
|
|
|
|
|
return map(lambda x:"on",
|
|
|
|
|
self.Get('cl_autopartition_disk_format')) + \
|
|
|
|
|
map(lambda x:"",
|
|
|
|
|
self.Get('cl_autopartition_bind_path'))
|
|
|
|
|
else:
|
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
|
fs = self.Get("os_location_format")
|
|
|
|
@ -846,16 +921,36 @@ class VariableOsLocationPerformFormat(Variable):
|
|
|
|
|
return map(self.defaultPerformFormat(),
|
|
|
|
|
info)
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationSize(LocationVariable,ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
Location size
|
|
|
|
|
"""
|
|
|
|
|
type = "list"
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Size")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
mapDevSize = dict(self.ZipVars('os_disk_dev','os_disk_size'))
|
|
|
|
|
mapDevSize.update(
|
|
|
|
|
zip(self.Get('cl_autopartition_disk_dev'),
|
|
|
|
|
self.Get('cl_autopartition_disk_size',humanreadable=True)))
|
|
|
|
|
|
|
|
|
|
return map(lambda x:mapDevSize.get(x,''),
|
|
|
|
|
self.Get('os_location_source'))
|
|
|
|
|
|
|
|
|
|
class VariableClUuidSet(Variable):
|
|
|
|
|
"""
|
|
|
|
|
Use or not UUID for /etc/fstab
|
|
|
|
|
"""
|
|
|
|
|
type = "bool"
|
|
|
|
|
label = _("Use UUID")
|
|
|
|
|
opt = ["--uuid"]
|
|
|
|
|
help = _("use UUID")
|
|
|
|
|
value = "on"
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Use UUID")
|
|
|
|
|
self.help = _("use UUID")
|
|
|
|
|
|
|
|
|
|
#############################################################
|
|
|
|
|
# Install disk parameters
|
|
|
|
|
#############################################################
|
|
|
|
@ -978,6 +1073,8 @@ class VariableOsInstallDiskId(ReadonlyVariable):
|
|
|
|
|
def get(self):
|
|
|
|
|
diskId = dict(zip(self.Get('os_disk_dev'),
|
|
|
|
|
self.Get('os_disk_id')))
|
|
|
|
|
diskId.update(zip(self.Get('cl_autopartition_disk_dev'),
|
|
|
|
|
[""]*len(self.Get('cl_autopartition_disk_dev'))))
|
|
|
|
|
def getIdByFS(fs,parttable,oldid):
|
|
|
|
|
if parttable == "gpt":
|
|
|
|
|
return PartitionDistributive.formatIdGpt.get(fs,oldid)
|
|
|
|
@ -1016,7 +1113,7 @@ class VariableOsInstallDiskSize(ReadonlyVariable):
|
|
|
|
|
type = "list"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
diskSize = dict(self.ZipVars('os_disk_dev','os_disk_size'))
|
|
|
|
|
diskSize = dict(self.ZipVars('os_location_source','os_location_size'))
|
|
|
|
|
return map(lambda x:diskSize.get(x,''),
|
|
|
|
|
self.Get('os_install_disk_dev'))
|
|
|
|
|
|
|
|
|
@ -1028,6 +1125,8 @@ class VariableOsInstallDiskType(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
diskType = dict(self.ZipVars('os_disk_dev','os_disk_type'))
|
|
|
|
|
diskType.update(self.ZipVars('cl_autopartition_disk_dev',
|
|
|
|
|
'cl_autopartition_disk_type'))
|
|
|
|
|
return map(lambda x:diskType.get(x,''),
|
|
|
|
|
self.Get('os_install_disk_dev'))
|
|
|
|
|
|
|
|
|
@ -1038,6 +1137,10 @@ class VariableOsInstallDiskParent(ReadonlyVariable):
|
|
|
|
|
type = "list"
|
|
|
|
|
def get(self):
|
|
|
|
|
diskParent = dict(self.ZipVars('os_disk_dev','os_disk_parent'))
|
|
|
|
|
# replace value for autopartition
|
|
|
|
|
diskParent.update(zip(self.Get('cl_autopartition_disk_dev'),
|
|
|
|
|
[self.Get('cl_autopartition_device')]*
|
|
|
|
|
len(self.Get('cl_autopartition_disk_dev'))))
|
|
|
|
|
return map(lambda x:diskParent.get(x,''),
|
|
|
|
|
self.Get('os_install_disk_dev'))
|
|
|
|
|
|
|
|
|
@ -1048,6 +1151,8 @@ class VariableOsInstallDiskPart(ReadonlyVariable):
|
|
|
|
|
type = "list"
|
|
|
|
|
def get(self):
|
|
|
|
|
diskPart = dict(self.ZipVars('os_disk_dev','os_disk_part'))
|
|
|
|
|
diskPart.update(self.ZipVars('cl_autopartition_disk_dev',
|
|
|
|
|
'cl_autopartition_disk_part'))
|
|
|
|
|
return map(lambda x:diskPart.get(x,''),
|
|
|
|
|
self.Get('os_install_disk_dev'))
|
|
|
|
|
|
|
|
|
@ -1080,14 +1185,16 @@ class VariableOsInstallBindMountpoint(ReadonlyVariable):
|
|
|
|
|
where='os_location_source',
|
|
|
|
|
func=lambda x:not x[0].startswith('/dev/') and x[1])
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallMbr(Variable):
|
|
|
|
|
class VariableOsInstallMbr(LocationVariable,Variable):
|
|
|
|
|
"""
|
|
|
|
|
Disks for boot mbr
|
|
|
|
|
"""
|
|
|
|
|
type = "choice-list"
|
|
|
|
|
opt = ["--mbr"]
|
|
|
|
|
metavalue = "MBR"
|
|
|
|
|
label = _("Disk for install")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Disk for install")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get default Master boot record install
|
|
|
|
@ -1105,7 +1212,7 @@ class VariableOsInstallMbr(Variable):
|
|
|
|
|
# if loaded system livecd
|
|
|
|
|
if self.Get('os_root_type') == "livecd":
|
|
|
|
|
# search /boot device or / device, by priority /boot,/
|
|
|
|
|
bootDev=self.Select('os_disk_install_parent',
|
|
|
|
|
bootDev=self.Select('os_install_disk_parent',
|
|
|
|
|
where='os_install_disk_mount',
|
|
|
|
|
_in=('/','/boot'),
|
|
|
|
|
sort="DESC",limit=1)
|
|
|
|
@ -1182,16 +1289,18 @@ class VariableOsInstallMbr(Variable):
|
|
|
|
|
_("Legacy grub does not support booting from %s without "
|
|
|
|
|
"separate /boot partition")%bootDiskFormat)
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallRootType(Variable):
|
|
|
|
|
class VariableOsInstallRootType(LocationVariable,Variable):
|
|
|
|
|
"""
|
|
|
|
|
Type of installation
|
|
|
|
|
"""
|
|
|
|
|
label = _("Installation type")
|
|
|
|
|
opt = ["--type"]
|
|
|
|
|
metavalue = "DISKTYPE"
|
|
|
|
|
help = _("device type for the system bound for install")
|
|
|
|
|
type = "choice"
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.help = _("device type for the system bound for install")
|
|
|
|
|
self.label = _("Installation type")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
rootdev = self.Get('os_install_root_dev')
|
|
|
|
|
devicetype = getPartitionDevice(
|
|
|
|
@ -1286,7 +1395,9 @@ class VariableOsInstallDiskSingle(Variable):
|
|
|
|
|
Installation disk
|
|
|
|
|
"""
|
|
|
|
|
type = "choice"
|
|
|
|
|
label = _("Installation disk")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Installation disk")
|
|
|
|
|
|
|
|
|
|
def availDevs(self):
|
|
|
|
|
"""
|
|
|
|
|