|
|
@ -45,13 +45,13 @@ setLocalTranslate('cl_install3', sys.modules[__name__])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceHelper(VariableInterface):
|
|
|
|
class DeviceHelper(VariableInterface):
|
|
|
|
rePassDevice = re.compile("^/block/(?!%s)" % "|".join(['sr', 'fd',
|
|
|
|
rePassDevice = re.compile(r"^/block/(?!%s)" % r"|".join([r'sr', r'fd',
|
|
|
|
'ram', 'loop']))
|
|
|
|
r'ram', r'loop']))
|
|
|
|
|
|
|
|
|
|
|
|
def getBlockDevices(self):
|
|
|
|
def getBlockDevices(self):
|
|
|
|
"""Get interest devices from sys block path"""
|
|
|
|
"""Get interest devices from sys block path"""
|
|
|
|
return filter(self.rePassDevice.search,
|
|
|
|
return list(filter(self.rePassDevice.search,
|
|
|
|
device.udev.get_block_devices())
|
|
|
|
device.udev.get_block_devices()))
|
|
|
|
|
|
|
|
|
|
|
|
def separateDevice(self, dev):
|
|
|
|
def separateDevice(self, dev):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -59,8 +59,8 @@ class DeviceHelper(VariableInterface):
|
|
|
|
|
|
|
|
|
|
|
|
Using for sort. (Example: sda2 ("sda",2), md5p1 ("md",5,"p",1)
|
|
|
|
Using for sort. (Example: sda2 ("sda",2), md5p1 ("md",5,"p",1)
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return map(lambda x: int(x) if x.isdigit() else x,
|
|
|
|
return list(map(lambda x: int(x) if x.isdigit() else x,
|
|
|
|
re.findall('\d+|\D+', dev))
|
|
|
|
re.findall(r'\d+|\D+', dev)))
|
|
|
|
|
|
|
|
|
|
|
|
def mapUdevProperty(self, var, prop, default):
|
|
|
|
def mapUdevProperty(self, var, prop, default):
|
|
|
|
"""Get each element from var through udev [prop]"""
|
|
|
|
"""Get each element from var through udev [prop]"""
|
|
|
@ -164,7 +164,7 @@ class VariableOsDeviceDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
Disk devices
|
|
|
|
Disk devices
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
type = "list"
|
|
|
|
type = "list"
|
|
|
|
re_disk_raid = re.compile("^disk-.*-raid\d+$", re.I)
|
|
|
|
re_disk_raid = re.compile(r"^disk-.*-raid\d+$", re.I)
|
|
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
def init(self):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
@ -228,8 +228,8 @@ class VariableOsDeviceType(ReadonlyVariable):
|
|
|
|
device.devfs.listdir(diskIdPath, fullpath=False)))
|
|
|
|
device.devfs.listdir(diskIdPath, fullpath=False)))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.usbdevices = []
|
|
|
|
self.usbdevices = []
|
|
|
|
return map(self.getType,
|
|
|
|
return list(map(self.getType,
|
|
|
|
self.Get('os_device_dev'))
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceParent(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceParent(ReadonlyVariable):
|
|
|
@ -313,8 +313,8 @@ class VariableOsDeviceMap(ReadonlyVariable):
|
|
|
|
type = "list"
|
|
|
|
type = "list"
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
return map(lambda x: str(x[0]),
|
|
|
|
return list(map(lambda x: str(x[0]),
|
|
|
|
enumerate(self.Get('os_device_dev')))
|
|
|
|
enumerate(self.Get('os_device_dev'))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceArraySet(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceArraySet(ReadonlyVariable):
|
|
|
@ -334,9 +334,9 @@ class VariableOsDeviceArraySet(ReadonlyVariable):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return "off"
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
|
|
return map(lambda x: isArray(*x),
|
|
|
|
return list(map(lambda x: isArray(*x),
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
self.Get('os_device_name')))
|
|
|
|
self.Get('os_device_name'))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceSsdSet(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceSsdSet(ReadonlyVariable):
|
|
|
@ -361,9 +361,9 @@ class VariableOsDeviceSsdSet(ReadonlyVariable):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return "off"
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
|
|
return map(lambda x: isSsd(*x),
|
|
|
|
return list(map(lambda x: isSsd(*x),
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
self.Get('os_device_name')))
|
|
|
|
self.Get('os_device_name'))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceSyspath(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceSyspath(ReadonlyVariable):
|
|
|
@ -403,10 +403,10 @@ class VariableOsDeviceVirtualSet(ReadonlyVariable):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return "off"
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
|
|
return map(lambda x: isVirtual(*x),
|
|
|
|
return list(map(lambda x: isVirtual(*x),
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
self.Get('os_device_name'),
|
|
|
|
self.Get('os_device_name'),
|
|
|
|
self.Get('os_device_syspath')))
|
|
|
|
self.Get('os_device_syspath'))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceTable(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceTable(ReadonlyVariable):
|
|
|
@ -444,8 +444,8 @@ class VariableOsDeviceTable(ReadonlyVariable):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return getTable(dev)
|
|
|
|
return getTable(dev)
|
|
|
|
|
|
|
|
|
|
|
|
return map(getByAutopartition,
|
|
|
|
return list(map(getByAutopartition,
|
|
|
|
self.Get('os_device_dev'))
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceName(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceName(ReadonlyVariable):
|
|
|
@ -475,8 +475,8 @@ class VariableOsDeviceName(ReadonlyVariable):
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
return map(self.getName,
|
|
|
|
return list(map(self.getName,
|
|
|
|
self.Get('os_device_dev'))
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceSize(ReadonlyVariable):
|
|
|
|
class VariableOsDeviceSize(ReadonlyVariable):
|
|
|
@ -487,12 +487,12 @@ class VariableOsDeviceSize(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
"""Get device size"""
|
|
|
|
"""Get device size"""
|
|
|
|
return map(lambda x: getPartitionSize(name=x, inBytes=True),
|
|
|
|
return list(map(lambda x: getPartitionSize(name=x, inBytes=True),
|
|
|
|
self.Get('os_device_dev'))
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
def humanReadable(self):
|
|
|
|
return map(humanreadableSize,
|
|
|
|
return list(map(humanreadableSize,
|
|
|
|
self.Get())
|
|
|
|
self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#############################################
|
|
|
|
#############################################
|
|
|
@ -526,7 +526,7 @@ class VariableOsDiskDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
# получить блочные утсройства, в списке устройства с таблицей раздела
|
|
|
|
# получить блочные утсройства, в списке устройства с таблицей раздела
|
|
|
|
# разделены '/'
|
|
|
|
# разделены '/'
|
|
|
|
re_parent = re.compile("^/block/[^/]+")
|
|
|
|
re_parent = re.compile(r"^/block/[^/]+")
|
|
|
|
disks = self.getBlockDevices()
|
|
|
|
disks = self.getBlockDevices()
|
|
|
|
parents = {re_parent.search(x).group()
|
|
|
|
parents = {re_parent.search(x).group()
|
|
|
|
for x in disks if x.count("/") > 2}
|
|
|
|
for x in disks if x.count("/") > 2}
|
|
|
@ -536,8 +536,8 @@ class VariableOsDiskDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
return list(sorted((x for x in dev_names), key=self.separateDevice))
|
|
|
|
return list(sorted((x for x in dev_names), key=self.separateDevice))
|
|
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
def humanReadable(self):
|
|
|
|
return map(self.getPerfectName,
|
|
|
|
return list(map(self.getPerfectName,
|
|
|
|
self.Get())
|
|
|
|
self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskMount(DeviceHelper, ReadonlyVariable):
|
|
|
|
class VariableOsDiskMount(DeviceHelper, ReadonlyVariable):
|
|
|
@ -550,8 +550,8 @@ class VariableOsDiskMount(DeviceHelper, ReadonlyVariable):
|
|
|
|
disk_hash = self.Get('os_disk_dev')
|
|
|
|
disk_hash = self.Get('os_disk_dev')
|
|
|
|
fstab = FStab('/etc/fstab', devs=disk_hash)
|
|
|
|
fstab = FStab('/etc/fstab', devs=disk_hash)
|
|
|
|
rootdev = self.Get('os_root_dev')
|
|
|
|
rootdev = self.Get('os_root_dev')
|
|
|
|
return map(lambda x: '/' if x == rootdev else fstab.getBy(eq=x) or "",
|
|
|
|
return list(map(lambda x: '/' if x == rootdev else fstab.getBy(eq=x) or "",
|
|
|
|
self.Get('os_disk_dev'))
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskContent(ReadonlyVariable):
|
|
|
|
class VariableOsDiskContent(ReadonlyVariable):
|
|
|
@ -564,8 +564,8 @@ class VariableOsDiskContent(ReadonlyVariable):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
TODO: need to write
|
|
|
|
TODO: need to write
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
return map(lambda x: "",
|
|
|
|
return list(map(lambda x: "",
|
|
|
|
self.Get('os_disk_dev'))
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskFormat(ReadonlyVariable):
|
|
|
|
class VariableOsDiskFormat(ReadonlyVariable):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -593,8 +593,8 @@ class VariableOsDiskFormat(ReadonlyVariable):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
return fs
|
|
|
|
return fs
|
|
|
|
|
|
|
|
|
|
|
|
return map(getFormat,
|
|
|
|
return list(map(getFormat,
|
|
|
|
self.Get('os_disk_dev'))
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
class VariableOsDiskType(ReadonlyVariable):
|
|
|
@ -602,8 +602,8 @@ class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
List type (lvm,raid,partition,disk)
|
|
|
|
List type (lvm,raid,partition,disk)
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
type = "list"
|
|
|
|
type = "list"
|
|
|
|
re_raid = re.compile("-raid\d+$")
|
|
|
|
re_raid = re.compile(r"-raid\d+$")
|
|
|
|
re_raid_partition = re.compile("-raid\d+-partition$")
|
|
|
|
re_raid_partition = re.compile(r"-raid\d+-partition$")
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
"""Get partition scheme"""
|
|
|
|
"""Get partition scheme"""
|
|
|
@ -642,9 +642,9 @@ class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
lvmUsedDisks[x].append(dev)
|
|
|
|
lvmUsedDisks[x].append(dev)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
lvmUsedDisks[x] = [dev]
|
|
|
|
lvmUsedDisks[x] = [dev]
|
|
|
|
return map(lambda x: x[1],
|
|
|
|
return list(map(lambda x: x[1],
|
|
|
|
map(forMember,
|
|
|
|
map(forMember,
|
|
|
|
types))
|
|
|
|
types)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskRaid(ReadonlyVariable):
|
|
|
|
class VariableOsDiskRaid(ReadonlyVariable):
|
|
|
@ -672,8 +672,8 @@ class VariableOsDiskLvm(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
"""Get each element from var through udev [prop]"""
|
|
|
|
"""Get each element from var through udev [prop]"""
|
|
|
|
return map(self.getLvmName,
|
|
|
|
return list(map(self.getLvmName,
|
|
|
|
self.Get('os_disk_dev'))
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskUuid(DeviceHelper, ReadonlyVariable):
|
|
|
|
class VariableOsDiskUuid(DeviceHelper, ReadonlyVariable):
|
|
|
@ -723,10 +723,10 @@ class VariableOsDiskId(DeviceHelper, ReadonlyVariable):
|
|
|
|
'21686148-6449-6e6f-744e-656564454649': 'EF02',
|
|
|
|
'21686148-6449-6e6f-744e-656564454649': 'EF02',
|
|
|
|
'c12a7328-f81f-11d2-ba4b-00a0c93ec93b': 'EF00',
|
|
|
|
'c12a7328-f81f-11d2-ba4b-00a0c93ec93b': 'EF00',
|
|
|
|
'0fc63daf-8483-4772-8e79-3d69d8477de4': '8300'}
|
|
|
|
'0fc63daf-8483-4772-8e79-3d69d8477de4': '8300'}
|
|
|
|
return map(lambda x: mapTypeUUID.get(x, x),
|
|
|
|
return list(map(lambda x: mapTypeUUID.get(x, x),
|
|
|
|
map(lambda x: x.rpartition("x")[2],
|
|
|
|
map(lambda x: x.rpartition("x")[2],
|
|
|
|
self.mapUdevProperty('os_disk_dev', 'ID_PART_ENTRY_TYPE',
|
|
|
|
self.mapUdevProperty('os_disk_dev', 'ID_PART_ENTRY_TYPE',
|
|
|
|
'')))
|
|
|
|
''))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskGrub(ReadonlyVariable):
|
|
|
|
class VariableOsDiskGrub(ReadonlyVariable):
|
|
|
@ -753,10 +753,10 @@ class VariableOsDiskGrub(ReadonlyVariable):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
return map(getGrubMap,
|
|
|
|
return list(map(getGrubMap,
|
|
|
|
zip(self.Get('os_disk_dev'),
|
|
|
|
zip(self.Get('os_disk_dev'),
|
|
|
|
self.Get('os_disk_type'),
|
|
|
|
self.Get('os_disk_type'),
|
|
|
|
self.Get('os_disk_parent')))
|
|
|
|
self.Get('os_disk_parent'))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskPart(ReadonlyVariable):
|
|
|
|
class VariableOsDiskPart(ReadonlyVariable):
|
|
|
@ -786,12 +786,12 @@ class VariableOsDiskSize(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
"""Get disk size"""
|
|
|
|
"""Get disk size"""
|
|
|
|
return map(lambda x: getPartitionSize(name=x, inBytes=True),
|
|
|
|
return list(map(lambda x: getPartitionSize(name=x, inBytes=True),
|
|
|
|
self.Get('os_disk_dev'))
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
def humanReadable(self):
|
|
|
|
return map(humanreadableSize,
|
|
|
|
return list(map(humanreadableSize,
|
|
|
|
self.Get())
|
|
|
|
self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskName(DeviceHelper, ReadonlyVariable):
|
|
|
|
class VariableOsDiskName(DeviceHelper, ReadonlyVariable):
|
|
|
@ -817,8 +817,8 @@ class VariableOsDiskOptions(ReadonlyVariable):
|
|
|
|
def getFormat(dev):
|
|
|
|
def getFormat(dev):
|
|
|
|
return fstab.getBy(what=fstab.OPTS, eq=dev)
|
|
|
|
return fstab.getBy(what=fstab.OPTS, eq=dev)
|
|
|
|
|
|
|
|
|
|
|
|
return map(getFormat,
|
|
|
|
return list(map(getFormat,
|
|
|
|
self.Get('os_disk_dev'))
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################
|
|
|
|
################################################
|
|
|
@ -1042,11 +1042,11 @@ class VariableOsLocationSource(LocationHelper, DeviceHelper, Variable):
|
|
|
|
return path.normpath(val)
|
|
|
|
return path.normpath(val)
|
|
|
|
return val
|
|
|
|
return val
|
|
|
|
|
|
|
|
|
|
|
|
return map(normpath, value)
|
|
|
|
return list(map(normpath, value))
|
|
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
def choice(self):
|
|
|
|
return map(lambda x: (x, self.getPerfectName(x) or x),
|
|
|
|
return list(map(lambda x: (x, self.getPerfectName(x) or x),
|
|
|
|
self.fixOsDiskDev(self.availDevs(choice=True))) + [("", "")]
|
|
|
|
self.fixOsDiskDev(self.availDevs(choice=True)))) + [("", "")]
|
|
|
|
|
|
|
|
|
|
|
|
def fixOsDiskDev(self, sourcelist=None):
|
|
|
|
def fixOsDiskDev(self, sourcelist=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -1141,12 +1141,12 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
return ""
|
|
|
|
return ""
|
|
|
|
return mount
|
|
|
|
return mount
|
|
|
|
|
|
|
|
|
|
|
|
return map(installMountPoint,
|
|
|
|
return list(map(installMountPoint,
|
|
|
|
filter(lambda x: x[0] in source,
|
|
|
|
filter(lambda x: x[0] in source,
|
|
|
|
zip(self.Get('os_disk_dev'),
|
|
|
|
list(zip(self.Get('os_disk_dev'),
|
|
|
|
self.Get('os_disk_mount')) + \
|
|
|
|
self.Get('os_disk_mount'))) + \
|
|
|
|
zip(self.Get('os_bind_path'),
|
|
|
|
list(zip(self.Get('os_bind_path'),
|
|
|
|
self.Get('os_bind_mountpoint'))))
|
|
|
|
self.Get('os_bind_mountpoint'))))))
|
|
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
def set(self, value):
|
|
|
|
"""Add abilitiy not specify root"""
|
|
|
|
"""Add abilitiy not specify root"""
|
|
|
@ -1157,7 +1157,7 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
return val
|
|
|
|
return val
|
|
|
|
|
|
|
|
|
|
|
|
value = map(normpath, value)
|
|
|
|
value = map(normpath, value)
|
|
|
|
return map(lambda x: x or "/", value)
|
|
|
|
return list(map(lambda x: x or "/", value))
|
|
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
def choice(self):
|
|
|
|
if self.Get('cl_install_type') == 'flash':
|
|
|
|
if self.Get('cl_install_type') == 'flash':
|
|
|
@ -1179,7 +1179,7 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
not "/usr" in value:
|
|
|
|
not "/usr" in value:
|
|
|
|
for mp, size in filter(lambda x: x[0] == '/' and x[1].isdigit() and \
|
|
|
|
for mp, size in filter(lambda x: x[0] == '/' and x[1].isdigit() and \
|
|
|
|
int(x[1]) < minroot,
|
|
|
|
int(x[1]) < minroot,
|
|
|
|
izip(value,
|
|
|
|
zip(value,
|
|
|
|
self.Get("os_location_size"))):
|
|
|
|
self.Get("os_location_size"))):
|
|
|
|
raise VariableError(
|
|
|
|
raise VariableError(
|
|
|
|
_("The root partition should be at least %s") % "7 Gb")
|
|
|
|
_("The root partition should be at least %s") % "7 Gb")
|
|
|
@ -1189,19 +1189,19 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
################################
|
|
|
|
################################
|
|
|
|
if not source:
|
|
|
|
if not source:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
if not filter(lambda x: x == "/", value):
|
|
|
|
if not list(filter(lambda x: x == "/", value)):
|
|
|
|
raise VariableError(_("To install the system, you need to "
|
|
|
|
raise VariableError(_("To install the system, you need to "
|
|
|
|
"specify the root device"))
|
|
|
|
"specify the root device"))
|
|
|
|
################################
|
|
|
|
################################
|
|
|
|
disks = filter(lambda x: x[0].startswith('/dev/') and x[1],
|
|
|
|
disks = list(filter(lambda x: x[0].startswith('/dev/') and x[1],
|
|
|
|
zip(source, value))
|
|
|
|
zip(source, value)))
|
|
|
|
disksDevs = map(lambda x: x[0], disks)
|
|
|
|
disksDevs = list(map(lambda x: x[0], disks))
|
|
|
|
binds = filter(lambda x: not x[0].startswith('/dev/') and x[1],
|
|
|
|
binds = list(filter(lambda x: not x[0].startswith('/dev/') and x[1],
|
|
|
|
zip(source, value))
|
|
|
|
zip(source, value)))
|
|
|
|
##########################
|
|
|
|
##########################
|
|
|
|
# detect efi specifing
|
|
|
|
# detect efi specifing
|
|
|
|
##########################
|
|
|
|
##########################
|
|
|
|
reEfi = re.compile("/u?efi", re.I)
|
|
|
|
reEfi = re.compile(r"/u?efi", re.I)
|
|
|
|
if any(reEfi.search(x) for x in value):
|
|
|
|
if any(reEfi.search(x) for x in value):
|
|
|
|
if self.Get('cl_client_type') == 'gui':
|
|
|
|
if self.Get('cl_client_type') == 'gui':
|
|
|
|
raise VariableError(
|
|
|
|
raise VariableError(
|
|
|
@ -1271,10 +1271,10 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
DEVICE, MP = 0, 1
|
|
|
|
DEVICE, MP = 0, 1
|
|
|
|
srcMountPoints = map(lambda x: x[DEVICE], binds)
|
|
|
|
srcMountPoints = map(lambda x: x[DEVICE], binds)
|
|
|
|
destMountPoints = map(lambda x: x[MP], binds)
|
|
|
|
destMountPoints = map(lambda x: x[MP], binds)
|
|
|
|
wrongBind = filter(lambda x: x in destMountPoints, srcMountPoints)
|
|
|
|
wrongBind = list(filter(lambda x: x in destMountPoints, srcMountPoints))
|
|
|
|
if wrongBind:
|
|
|
|
if wrongBind:
|
|
|
|
incompBind = filter(lambda x: x[1] == wrongBind[0],
|
|
|
|
incompBind = list(filter(lambda x: x[1] == wrongBind[0],
|
|
|
|
zip(srcMountPoints, destMountPoints))
|
|
|
|
zip(srcMountPoints, destMountPoints)))
|
|
|
|
raise VariableError(
|
|
|
|
raise VariableError(
|
|
|
|
_("Source directory %(src)s is already used "
|
|
|
|
_("Source directory %(src)s is already used "
|
|
|
|
"for binding '%(bindSrc)s' to '%(bindDst)s'") \
|
|
|
|
"for binding '%(bindSrc)s' to '%(bindDst)s'") \
|
|
|
@ -1298,8 +1298,8 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
installTypes = zip(self.Get('os_install_disk_dev'),
|
|
|
|
installTypes = zip(self.Get('os_install_disk_dev'),
|
|
|
|
self.Get('os_install_disk_type'))
|
|
|
|
self.Get('os_install_disk_type'))
|
|
|
|
for checkType in ("raid", "lvm"):
|
|
|
|
for checkType in ("raid", "lvm"):
|
|
|
|
memberData = filter(lambda x: checkType + "member" in x[1],
|
|
|
|
memberData = list(filter(lambda x: checkType + "member" in x[1],
|
|
|
|
installTypes)
|
|
|
|
installTypes))
|
|
|
|
if memberData:
|
|
|
|
if memberData:
|
|
|
|
raise VariableError(
|
|
|
|
raise VariableError(
|
|
|
|
_("Unable to use {part} partition used by active "
|
|
|
|
_("Unable to use {part} partition used by active "
|
|
|
@ -1317,13 +1317,13 @@ class VariableOsLocationFormat(LocationHelper, Variable):
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
return self.Get('cl_autopartition_disk_format') + \
|
|
|
|
return self.Get('cl_autopartition_disk_format') + \
|
|
|
|
map(lambda x: "", self.Get('cl_autopartition_bind_path'))
|
|
|
|
list(map(lambda x: "", self.Get('cl_autopartition_bind_path')))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
value = [""] * len(source)
|
|
|
|
value = [""] * len(source)
|
|
|
|
return map(self.defaultFormat(),
|
|
|
|
return list(map(self.defaultFormat(),
|
|
|
|
zip(source, mount, value))
|
|
|
|
zip(source, mount, value)))
|
|
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
def choice(self):
|
|
|
|
if self.Get('cl_install_type') == "flash":
|
|
|
|
if self.Get('cl_install_type') == "flash":
|
|
|
@ -1384,8 +1384,8 @@ class VariableOsLocationFormat(LocationHelper, Variable):
|
|
|
|
value = map(lambda x: "vfat" if x == "uefi" else x, value)
|
|
|
|
value = map(lambda x: "vfat" if x == "uefi" else x, value)
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
return map(self.defaultFormat(),
|
|
|
|
return list(map(self.defaultFormat(),
|
|
|
|
zip(source, mount, value))
|
|
|
|
zip(source, mount, value)))
|
|
|
|
|
|
|
|
|
|
|
|
def check(self, value):
|
|
|
|
def check(self, value):
|
|
|
|
osInstallRootType = self.Get('os_install_root_type')
|
|
|
|
osInstallRootType = self.Get('os_install_root_type')
|
|
|
@ -1423,17 +1423,17 @@ class VariableOsLocationPerformFormat(LocationHelper, Variable):
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
return map(lambda x: "on",
|
|
|
|
return list(map(lambda x: "on",
|
|
|
|
self.Get('cl_autopartition_disk_format')) + \
|
|
|
|
self.Get('cl_autopartition_disk_format'))) + \
|
|
|
|
map(lambda x: "",
|
|
|
|
list(map(lambda x: "",
|
|
|
|
self.Get('cl_autopartition_bind_path'))
|
|
|
|
self.Get('cl_autopartition_bind_path')))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
fs = self.Get("os_location_format")
|
|
|
|
fs = self.Get("os_location_format")
|
|
|
|
value = [""] * len(source)
|
|
|
|
value = [""] * len(source)
|
|
|
|
return map(self.defaultPerformFormat(),
|
|
|
|
return list(map(self.defaultPerformFormat(),
|
|
|
|
zip(source, mount, fs, value))
|
|
|
|
zip(source, mount, fs, value)))
|
|
|
|
|
|
|
|
|
|
|
|
fixNtfs = lambda self, x: {'ntfs-3g': 'ntfs'}.get(x, x)
|
|
|
|
fixNtfs = lambda self, x: {'ntfs-3g': 'ntfs'}.get(x, x)
|
|
|
|
|
|
|
|
|
|
|
@ -1531,11 +1531,11 @@ class VariableOsLocationPerformFormat(LocationHelper, Variable):
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
self.Get('os_location_format'),
|
|
|
|
self.Get('os_location_format'),
|
|
|
|
value)
|
|
|
|
value)
|
|
|
|
return map(self.defaultPerformFormat(),
|
|
|
|
return list(map(self.defaultPerformFormat(),
|
|
|
|
map(lambda x: [x[DEV], x[MP], x[FS], ""] \
|
|
|
|
map(lambda x: [x[DEV], x[MP], x[FS], ""] \
|
|
|
|
if x[FORMAT] == "off" and not x[DEV].startswith("/dev/")
|
|
|
|
if x[FORMAT] == "off" and not x[DEV].startswith("/dev/")
|
|
|
|
else x,
|
|
|
|
else x,
|
|
|
|
info))
|
|
|
|
info)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationSize(LocationHelper, SourceReadonlyVariable):
|
|
|
|
class VariableOsLocationSize(LocationHelper, SourceReadonlyVariable):
|
|
|
@ -1678,8 +1678,8 @@ class VariableOsInstallDiskDev(ReadonlyVariable, DeviceHelper):
|
|
|
|
self.Get('os_install_disk_dev_base'))
|
|
|
|
self.Get('os_install_disk_dev_base'))
|
|
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
def humanReadable(self):
|
|
|
|
return map(lambda x: self.getPerfectName(x, defaultValue=x),
|
|
|
|
return list(map(lambda x: self.getPerfectName(x, defaultValue=x),
|
|
|
|
self.Get())
|
|
|
|
self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskUuid(ReadonlyVariable):
|
|
|
|
class VariableOsInstallDiskUuid(ReadonlyVariable):
|
|
|
@ -1691,7 +1691,7 @@ class VariableOsInstallDiskUuid(ReadonlyVariable):
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
diskDev = self.Get('os_install_disk_dev')
|
|
|
|
diskDev = self.Get('os_install_disk_dev')
|
|
|
|
hashUUID = getUUIDDict(revers=True)
|
|
|
|
hashUUID = getUUIDDict(revers=True)
|
|
|
|
return map(lambda x: hashUUID.get(x, "")[5:], diskDev)
|
|
|
|
return list(map(lambda x: hashUUID.get(x, "")[5:], diskDev))
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskPartuuid(ReadonlyVariable):
|
|
|
|
class VariableOsInstallDiskPartuuid(ReadonlyVariable):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -1756,9 +1756,9 @@ class VariableOsInstallDiskUse(ReadonlyVariable):
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
"""Get real id (by cl_uuid_set) device"""
|
|
|
|
"""Get real id (by cl_uuid_set) device"""
|
|
|
|
if self.Get('cl_uuid_set') == "on":
|
|
|
|
if self.Get('cl_uuid_set') == "on":
|
|
|
|
return map(lambda x: "UUID=%s" % x[0] if x[0] else x[1],
|
|
|
|
return list(map(lambda x: "UUID=%s" % x[0] if x[0] else x[1],
|
|
|
|
zip(self.Get('os_install_disk_uuid'),
|
|
|
|
zip(self.Get('os_install_disk_uuid'),
|
|
|
|
self.Get('os_install_disk_dev')))
|
|
|
|
self.Get('os_install_disk_dev'))))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return self.Get('os_install_disk_dev')
|
|
|
|
return self.Get('os_install_disk_dev')
|
|
|
|
|
|
|
|
|
|
|
@ -1820,11 +1820,11 @@ class VariableOsInstallDiskPerformFormat(ReadonlyVariable):
|
|
|
|
type = "bool-list"
|
|
|
|
type = "bool-list"
|
|
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
def get(self):
|
|
|
|
_format = map(lambda x: x[2],
|
|
|
|
_format = list(map(lambda x: x[2],
|
|
|
|
filter(lambda x: x[0].startswith('/dev/') and x[1],
|
|
|
|
filter(lambda x: x[0].startswith('/dev/') and x[1],
|
|
|
|
zip(self.Get('os_location_source'),
|
|
|
|
zip(self.Get('os_location_source'),
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
self.Get('os_location_perform_format'))))
|
|
|
|
self.Get('os_location_perform_format')))))
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
efiformat = ['on' for x in self.Get('os_install_uefi')]
|
|
|
|
efiformat = ['on' for x in self.Get('os_install_uefi')]
|
|
|
|
res = efiformat + _format
|
|
|
|
res = efiformat + _format
|
|
|
@ -1880,9 +1880,9 @@ class VariableOsInstallDiskName(Variable):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return diskLabel.get(dev, '')
|
|
|
|
return diskLabel.get(dev, '')
|
|
|
|
|
|
|
|
|
|
|
|
return map(changeLabel,
|
|
|
|
return list(map(changeLabel,
|
|
|
|
self.ZipVars('os_install_disk_dev',
|
|
|
|
self.ZipVars('os_install_disk_dev',
|
|
|
|
'os_install_disk_mount'))
|
|
|
|
'os_install_disk_mount')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskSize(SourceReadonlyVariable):
|
|
|
|
class VariableOsInstallDiskSize(SourceReadonlyVariable):
|
|
|
@ -2058,7 +2058,7 @@ class VariableOsInstallUefi(LocationHelper, Variable):
|
|
|
|
opt = ["--uefi"]
|
|
|
|
opt = ["--uefi"]
|
|
|
|
metavalue = "EFI"
|
|
|
|
metavalue = "EFI"
|
|
|
|
|
|
|
|
|
|
|
|
re_not0_raid = re.compile("-raid[1-9]")
|
|
|
|
re_not0_raid = re.compile(r"-raid[1-9]")
|
|
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
def init(self):
|
|
|
|
self.label = _("UEFI boot")
|
|
|
|
self.label = _("UEFI boot")
|
|
|
@ -2118,7 +2118,7 @@ class VariableOsInstallUefi(LocationHelper, Variable):
|
|
|
|
return self.select('os_device_efi',
|
|
|
|
return self.select('os_device_efi',
|
|
|
|
os_device_dev=efidev, limit=1) or efidev
|
|
|
|
os_device_dev=efidev, limit=1) or efidev
|
|
|
|
return efidev
|
|
|
|
return efidev
|
|
|
|
return filter(lambda x: x != "off", map(transform, value))
|
|
|
|
return list(filter(lambda x: x != "off", map(transform, value)))
|
|
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
def choice(self):
|
|
|
|
deviceParentMap = self.ZipVars('os_device_dev',
|
|
|
|
deviceParentMap = self.ZipVars('os_device_dev',
|
|
|
@ -2233,7 +2233,7 @@ class VariableOsInstallMbr(LocationHelper, Variable):
|
|
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
def set(self, value):
|
|
|
|
# support off value
|
|
|
|
# support off value
|
|
|
|
return filter(lambda x: x != "off", value)
|
|
|
|
return list(filter(lambda x: x != "off", value))
|
|
|
|
|
|
|
|
|
|
|
|
def check(self, value):
|
|
|
|
def check(self, value):
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|