|
|
|
@ -50,8 +50,7 @@ class DeviceHelper(VariableInterface):
|
|
|
|
|
|
|
|
|
|
def getBlockDevices(self):
|
|
|
|
|
"""Get interest devices from sys block path"""
|
|
|
|
|
return list(filter(self.rePassDevice.search,
|
|
|
|
|
device.udev.get_block_devices()))
|
|
|
|
|
return list(filter(self.rePassDevice.search, device.udev.get_block_devices()))
|
|
|
|
|
|
|
|
|
|
def separateDevice(self, dev):
|
|
|
|
|
"""
|
|
|
|
@ -59,8 +58,7 @@ class DeviceHelper(VariableInterface):
|
|
|
|
|
|
|
|
|
|
Using for sort. (Example: sda2 ("sda",2), md5p1 ("md",5,"p",1)
|
|
|
|
|
"""
|
|
|
|
|
return list(map(lambda x: int(x) if x.isdigit() else x,
|
|
|
|
|
re.findall(r'\d+|\D+', dev)))
|
|
|
|
|
return [int(x) if x.isdigit() else x for x in re.findall(r'\d+|\D+', dev)]
|
|
|
|
|
|
|
|
|
|
def mapUdevProperty(self, var, prop, default):
|
|
|
|
|
"""Get each element from var through udev [prop]"""
|
|
|
|
@ -180,8 +178,7 @@ class VariableOsDeviceDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
if device.udev.is_device(device.udev.get_device_info(x)) or
|
|
|
|
|
self.re_disk_raid.match(device.udev.get_device_type(path=x)))
|
|
|
|
|
|
|
|
|
|
return list(sorted((x for x in devnames),
|
|
|
|
|
key=self.separateDevice))
|
|
|
|
|
return list(sorted((x for x in devnames), key=self.separateDevice))
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceFulltype(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
@ -228,8 +225,7 @@ class VariableOsDeviceType(ReadonlyVariable):
|
|
|
|
|
device.devfs.listdir(diskIdPath, fullpath=False)))
|
|
|
|
|
else:
|
|
|
|
|
self.usbdevices = []
|
|
|
|
|
return list(map(self.getType,
|
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
return list(map(self.getType, self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceParent(ReadonlyVariable):
|
|
|
|
@ -313,8 +309,7 @@ class VariableOsDeviceMap(ReadonlyVariable):
|
|
|
|
|
type = "list"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
return list(map(lambda x: str(x[0]),
|
|
|
|
|
enumerate(self.Get('os_device_dev'))))
|
|
|
|
|
return [str(x[0]) for x in enumerate(self.Get('os_device_dev'))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceArraySet(ReadonlyVariable):
|
|
|
|
@ -334,9 +329,7 @@ class VariableOsDeviceArraySet(ReadonlyVariable):
|
|
|
|
|
else:
|
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
return list(map(lambda x: isArray(*x),
|
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
|
self.Get('os_device_name'))))
|
|
|
|
|
return [isArray(*x) for x in zip(self.Get('os_device_dev'), self.Get('os_device_name'))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceSsdSet(ReadonlyVariable):
|
|
|
|
@ -361,9 +354,7 @@ class VariableOsDeviceSsdSet(ReadonlyVariable):
|
|
|
|
|
else:
|
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
return list(map(lambda x: isSsd(*x),
|
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
|
self.Get('os_device_name'))))
|
|
|
|
|
return [isSsd(*x) for x in zip(self.Get('os_device_dev'), self.Get('os_device_name'))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceSyspath(ReadonlyVariable):
|
|
|
|
@ -403,10 +394,9 @@ class VariableOsDeviceVirtualSet(ReadonlyVariable):
|
|
|
|
|
else:
|
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
return list(map(lambda x: isVirtual(*x),
|
|
|
|
|
zip(self.Get('os_device_dev'),
|
|
|
|
|
self.Get('os_device_name'),
|
|
|
|
|
self.Get('os_device_syspath'))))
|
|
|
|
|
return [isVirtual(*x) for x in zip(self.Get('os_device_dev'),
|
|
|
|
|
self.Get('os_device_name'),
|
|
|
|
|
self.Get('os_device_syspath'))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceTable(ReadonlyVariable):
|
|
|
|
@ -444,8 +434,8 @@ class VariableOsDeviceTable(ReadonlyVariable):
|
|
|
|
|
else:
|
|
|
|
|
return getTable(dev)
|
|
|
|
|
|
|
|
|
|
return list(map(getByAutopartition,
|
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
return list(map(getByAutopartition, self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceName(ReadonlyVariable):
|
|
|
|
@ -475,8 +465,7 @@ class VariableOsDeviceName(ReadonlyVariable):
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
return list(map(self.getName,
|
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
return list(map(self.getName, self.Get('os_device_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDeviceSize(ReadonlyVariable):
|
|
|
|
@ -487,12 +476,10 @@ class VariableOsDeviceSize(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get device size"""
|
|
|
|
|
return list(map(lambda x: getPartitionSize(name=x, inBytes=True),
|
|
|
|
|
self.Get('os_device_dev')))
|
|
|
|
|
return [getPartitionSize(name=x, inBytes=True) for x in self.Get('os_device_dev')]
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
return list(map(humanreadableSize,
|
|
|
|
|
self.Get()))
|
|
|
|
|
return list(map(humanreadableSize, self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#############################################
|
|
|
|
@ -536,8 +523,7 @@ class VariableOsDiskDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
return list(sorted((x for x in dev_names), key=self.separateDevice))
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
return list(map(self.getPerfectName,
|
|
|
|
|
self.Get()))
|
|
|
|
|
return list(map(self.getPerfectName, self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskMount(DeviceHelper, ReadonlyVariable):
|
|
|
|
@ -550,8 +536,7 @@ class VariableOsDiskMount(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
disk_hash = self.Get('os_disk_dev')
|
|
|
|
|
fstab = FStab('/etc/fstab', devs=disk_hash)
|
|
|
|
|
rootdev = self.Get('os_root_dev')
|
|
|
|
|
return list(map(lambda x: '/' if x == rootdev else fstab.getBy(eq=x) or "",
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
return ['/' if x == rootdev else fstab.getBy(eq=x) or "" for x in self.Get('os_disk_dev')]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskContent(ReadonlyVariable):
|
|
|
|
@ -564,8 +549,7 @@ class VariableOsDiskContent(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
TODO: need to write
|
|
|
|
|
"""
|
|
|
|
|
return list(map(lambda x: "",
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
return ["" for x in self.Get('os_disk_dev')]
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskFormat(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
@ -593,8 +577,7 @@ class VariableOsDiskFormat(ReadonlyVariable):
|
|
|
|
|
pass
|
|
|
|
|
return fs
|
|
|
|
|
|
|
|
|
|
return list(map(getFormat,
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
return list(map(getFormat, self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
@ -608,8 +591,7 @@ class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get partition scheme"""
|
|
|
|
|
|
|
|
|
|
types = list(map(lambda x: (x, device.udev.get_device_type(name=x)),
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
types = [(x, device.udev.get_device_type(name=x)) for x in self.Get('os_disk_dev')]
|
|
|
|
|
lvmUsedDisks = {}
|
|
|
|
|
raidUsedDisks = {}
|
|
|
|
|
|
|
|
|
@ -642,9 +624,8 @@ class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
|
lvmUsedDisks[x].append(dev)
|
|
|
|
|
else:
|
|
|
|
|
lvmUsedDisks[x] = [dev]
|
|
|
|
|
return list(map(lambda x: x[1],
|
|
|
|
|
map(forMember,
|
|
|
|
|
types)))
|
|
|
|
|
|
|
|
|
|
return [x[1] for x in map(forMember, types)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskRaid(ReadonlyVariable):
|
|
|
|
@ -672,8 +653,7 @@ class VariableOsDiskLvm(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get each element from var through udev [prop]"""
|
|
|
|
|
return list(map(self.getLvmName,
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
return list(map(self.getLvmName, self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskUuid(DeviceHelper, ReadonlyVariable):
|
|
|
|
@ -723,10 +703,9 @@ class VariableOsDiskId(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
'21686148-6449-6e6f-744e-656564454649': 'EF02',
|
|
|
|
|
'c12a7328-f81f-11d2-ba4b-00a0c93ec93b': 'EF00',
|
|
|
|
|
'0fc63daf-8483-4772-8e79-3d69d8477de4': '8300'}
|
|
|
|
|
return list(map(lambda x: mapTypeUUID.get(x, x),
|
|
|
|
|
map(lambda x: x.rpartition("x")[2],
|
|
|
|
|
self.mapUdevProperty('os_disk_dev', 'ID_PART_ENTRY_TYPE',
|
|
|
|
|
''))))
|
|
|
|
|
return [mapTypeUUID.get(x, x) for x
|
|
|
|
|
in [y.rpartition("x")[2] for y
|
|
|
|
|
in self.mapUdevProperty('os_disk_dev', 'ID_PART_ENTRY_TYPE','')]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskGrub(ReadonlyVariable):
|
|
|
|
@ -786,12 +765,10 @@ class VariableOsDiskSize(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get disk size"""
|
|
|
|
|
return list(map(lambda x: getPartitionSize(name=x, inBytes=True),
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
return [getPartitionSize(name=x, inBytes=True) for x in self.Get('os_disk_dev')]
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
return list(map(humanreadableSize,
|
|
|
|
|
self.Get()))
|
|
|
|
|
return list(map(humanreadableSize, self.Get()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskName(DeviceHelper, ReadonlyVariable):
|
|
|
|
@ -817,8 +794,7 @@ class VariableOsDiskOptions(ReadonlyVariable):
|
|
|
|
|
def getFormat(dev):
|
|
|
|
|
return fstab.getBy(what=fstab.OPTS, eq=dev)
|
|
|
|
|
|
|
|
|
|
return list(map(getFormat,
|
|
|
|
|
self.Get('os_disk_dev')))
|
|
|
|
|
return list(map(getFormat, self.Get('os_disk_dev')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################
|
|
|
|
@ -1045,8 +1021,8 @@ class VariableOsLocationSource(LocationHelper, DeviceHelper, Variable):
|
|
|
|
|
return list(map(normpath, value))
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
return list(map(lambda x: (x, self.getPerfectName(x) or x),
|
|
|
|
|
self.fixOsDiskDev(self.availDevs(choice=True)))) + [("", "")]
|
|
|
|
|
return [(x, self.getPerfectName(x) or x) for x
|
|
|
|
|
in self.fixOsDiskDev(self.availDevs(choice=True))] + [("", "")]
|
|
|
|
|
|
|
|
|
|
def fixOsDiskDev(self, sourcelist=None):
|
|
|
|
|
"""
|
|
|
|
@ -1085,8 +1061,7 @@ class VariableOsLocationSource(LocationHelper, DeviceHelper, Variable):
|
|
|
|
|
# get original /dev names
|
|
|
|
|
cnDisks = (device.udev.get_device_info(name=x).get('DEVNAME', x)
|
|
|
|
|
for x in disks)
|
|
|
|
|
wrongDevices = list(set(cnDisks) -
|
|
|
|
|
set(self.fixOsDiskDev()))
|
|
|
|
|
wrongDevices = list(set(cnDisks) - set(self.fixOsDiskDev()))
|
|
|
|
|
if wrongDevices:
|
|
|
|
|
raise VariableError(_("Wrong device '%s'") % wrongDevices[0])
|
|
|
|
|
wrongSource = filter(lambda x: x and not x.startswith('/'), value)
|
|
|
|
@ -1096,8 +1071,7 @@ class VariableOsLocationSource(LocationHelper, DeviceHelper, Variable):
|
|
|
|
|
##########################
|
|
|
|
|
# detect duplicate devices
|
|
|
|
|
##########################
|
|
|
|
|
dupDevices = list(set(filter(lambda x: disks.count(x) > 1,
|
|
|
|
|
disks)))
|
|
|
|
|
dupDevices = [x for x in disks if disks.count(x) > 1]
|
|
|
|
|
if dupDevices:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Device '%s' is used more than once") % dupDevices[0])
|
|
|
|
@ -1141,12 +1115,10 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
return ""
|
|
|
|
|
return mount
|
|
|
|
|
|
|
|
|
|
return list(map(installMountPoint,
|
|
|
|
|
filter(lambda x: x[0] in source,
|
|
|
|
|
list(zip(self.Get('os_disk_dev'),
|
|
|
|
|
self.Get('os_disk_mount'))) + \
|
|
|
|
|
list(zip(self.Get('os_bind_path'),
|
|
|
|
|
self.Get('os_bind_mountpoint'))))))
|
|
|
|
|
return [installMountPoint(x) for x
|
|
|
|
|
in list(zip(self.Get('os_disk_dev'),self.Get('os_disk_mount'))) + \
|
|
|
|
|
list(zip(self.Get('os_bind_path'),self.Get('os_bind_mountpoint')))
|
|
|
|
|
if x[0] in source]
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
|
"""Add abilitiy not specify root"""
|
|
|
|
@ -1157,7 +1129,7 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
return val
|
|
|
|
|
|
|
|
|
|
value = map(normpath, value)
|
|
|
|
|
return list(map(lambda x: x or "/", value))
|
|
|
|
|
return [x or "/" for x in value]
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
if self.Get('cl_install_type') == 'flash':
|
|
|
|
@ -1189,15 +1161,13 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
################################
|
|
|
|
|
if not source:
|
|
|
|
|
return
|
|
|
|
|
if not list(filter(lambda x: x == "/", value)):
|
|
|
|
|
if not [x for x in value if x == "/"]:
|
|
|
|
|
raise VariableError(_("To install the system, you need to "
|
|
|
|
|
"specify the root device"))
|
|
|
|
|
################################
|
|
|
|
|
disks = list(filter(lambda x: x[0].startswith('/dev/') and x[1],
|
|
|
|
|
zip(source, value)))
|
|
|
|
|
disksDevs = list(map(lambda x: x[0], disks))
|
|
|
|
|
binds = list(filter(lambda x: not x[0].startswith('/dev/') and x[1],
|
|
|
|
|
zip(source, value)))
|
|
|
|
|
disks = [x for x in zip(source, value) if x[0].startswith('/dev/') and x[1]]
|
|
|
|
|
disksDevs = [x[0] for x in disks]
|
|
|
|
|
binds = [x for x in zip(source, value) if not x[0].startswith('/dev/') and x[1]]
|
|
|
|
|
##########################
|
|
|
|
|
# detect efi specifing
|
|
|
|
|
##########################
|
|
|
|
@ -1213,9 +1183,7 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
##########################
|
|
|
|
|
# detect duplicate mps
|
|
|
|
|
##########################
|
|
|
|
|
dupMP = list(set(filter(lambda x: value.count(x) > 1,
|
|
|
|
|
filter(lambda x: x and x != "swap",
|
|
|
|
|
value))))
|
|
|
|
|
dupMP = list(set([x for x in [y for y in value if y and y != "swap"] if value.count(x) > 1]))
|
|
|
|
|
if dupMP:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Mount point '%s' is used more than once") % dupMP[0])
|
|
|
|
@ -1271,10 +1239,9 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
DEVICE, MP = 0, 1
|
|
|
|
|
srcMountPoints = map(lambda x: x[DEVICE], binds)
|
|
|
|
|
destMountPoints = map(lambda x: x[MP], binds)
|
|
|
|
|
wrongBind = list(filter(lambda x: x in destMountPoints, srcMountPoints))
|
|
|
|
|
wrongBind = [x for x in srcMountPoints if x in destMountPoints]
|
|
|
|
|
if wrongBind:
|
|
|
|
|
incompBind = list(filter(lambda x: x[1] == wrongBind[0],
|
|
|
|
|
zip(srcMountPoints, destMountPoints)))
|
|
|
|
|
incompBind = [x for x in zip(srcMountPoints, destMountPoints) if x[1] == wrongBind[0]]
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Source directory %(src)s is already used "
|
|
|
|
|
"for binding '%(bindSrc)s' to '%(bindDst)s'") \
|
|
|
|
@ -1298,8 +1265,7 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
installTypes = zip(self.Get('os_install_disk_dev'),
|
|
|
|
|
self.Get('os_install_disk_type'))
|
|
|
|
|
for checkType in ("raid", "lvm"):
|
|
|
|
|
memberData = list(filter(lambda x: checkType + "member" in x[1],
|
|
|
|
|
installTypes))
|
|
|
|
|
memberData = [x for x in installTypes if checkType + "member" in x[1]]
|
|
|
|
|
if memberData:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Unable to use {part} partition used by active "
|
|
|
|
@ -1317,13 +1283,12 @@ class VariableOsLocationFormat(LocationHelper, Variable):
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
|
return self.Get('cl_autopartition_disk_format') + \
|
|
|
|
|
list(map(lambda x: "", self.Get('cl_autopartition_bind_path')))
|
|
|
|
|
["" for x in self.Get('cl_autopartition_bind_path')]
|
|
|
|
|
else:
|
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
|
value = [""] * len(source)
|
|
|
|
|
return list(map(self.defaultFormat(),
|
|
|
|
|
zip(source, mount, value)))
|
|
|
|
|
return list(map(self.defaultFormat(), zip(source, mount, value)))
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
if self.Get('cl_install_type') == "flash":
|
|
|
|
@ -1384,8 +1349,7 @@ class VariableOsLocationFormat(LocationHelper, Variable):
|
|
|
|
|
value = map(lambda x: "vfat" if x == "uefi" else x, value)
|
|
|
|
|
mount = self.Get("os_location_dest")
|
|
|
|
|
source = self.Get("os_location_source")
|
|
|
|
|
return list(map(self.defaultFormat(),
|
|
|
|
|
zip(source, mount, value)))
|
|
|
|
|
return list(map(self.defaultFormat(), zip(source, mount, value)))
|
|
|
|
|
|
|
|
|
|
def check(self, value):
|
|
|
|
|
osInstallRootType = self.Get('os_install_root_type')
|
|
|
|
@ -1423,17 +1387,14 @@ class VariableOsLocationPerformFormat(LocationHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
|
return list(map(lambda x: "on",
|
|
|
|
|
self.Get('cl_autopartition_disk_format'))) + \
|
|
|
|
|
list(map(lambda x: "",
|
|
|
|
|
self.Get('cl_autopartition_bind_path')))
|
|
|
|
|
return ["on" for x in self.Get('cl_autopartition_disk_format')] + \
|
|
|
|
|
["" for x in 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")
|
|
|
|
|
value = [""] * len(source)
|
|
|
|
|
return list(map(self.defaultPerformFormat(),
|
|
|
|
|
zip(source, mount, fs, value)))
|
|
|
|
|
return list(map(self.defaultPerformFormat(), zip(source, mount, fs, value)))
|
|
|
|
|
|
|
|
|
|
fixNtfs = lambda self, x: {'ntfs-3g': 'ntfs'}.get(x, x)
|
|
|
|
|
|
|
|
|
@ -1531,11 +1492,9 @@ class VariableOsLocationPerformFormat(LocationHelper, Variable):
|
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
|
self.Get('os_location_format'),
|
|
|
|
|
value)
|
|
|
|
|
return list(map(self.defaultPerformFormat(),
|
|
|
|
|
map(lambda x: [x[DEV], x[MP], x[FS], ""] \
|
|
|
|
|
if x[FORMAT] == "off" and not x[DEV].startswith("/dev/")
|
|
|
|
|
else x,
|
|
|
|
|
info)))
|
|
|
|
|
return [self.defaultPerformFormat()(x) for x
|
|
|
|
|
in [[y[DEV], y[MP], y[FS], ""]
|
|
|
|
|
if y[FORMAT] == "off" and not y[DEV].startswith("/dev/") else y for y in info]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationSize(LocationHelper, SourceReadonlyVariable):
|
|
|
|
@ -1678,8 +1637,7 @@ class VariableOsInstallDiskDev(ReadonlyVariable, DeviceHelper):
|
|
|
|
|
self.Get('os_install_disk_dev_base'))
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
return list(map(lambda x: self.getPerfectName(x, defaultValue=x),
|
|
|
|
|
self.Get()))
|
|
|
|
|
return [self.getPerfectName(x, defaultValue=x) for x in self.Get()]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskUuid(ReadonlyVariable):
|
|
|
|
@ -1691,7 +1649,7 @@ class VariableOsInstallDiskUuid(ReadonlyVariable):
|
|
|
|
|
def get(self):
|
|
|
|
|
diskDev = self.Get('os_install_disk_dev')
|
|
|
|
|
hashUUID = getUUIDDict(revers=True)
|
|
|
|
|
return list(map(lambda x: hashUUID.get(x, "")[5:], diskDev))
|
|
|
|
|
return [hashUUID.get(x, "")[5:] for x in diskDev]
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskPartuuid(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
@ -1756,9 +1714,8 @@ class VariableOsInstallDiskUse(ReadonlyVariable):
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get real id (by cl_uuid_set) device"""
|
|
|
|
|
if self.Get('cl_uuid_set') == "on":
|
|
|
|
|
return list(map(lambda x: "UUID=%s" % x[0] if x[0] else x[1],
|
|
|
|
|
zip(self.Get('os_install_disk_uuid'),
|
|
|
|
|
self.Get('os_install_disk_dev'))))
|
|
|
|
|
return ["UUID=%s" % x[0] if x[0] else x[1] for x
|
|
|
|
|
in zip(self.Get('os_install_disk_uuid'), self.Get('os_install_disk_dev'))]
|
|
|
|
|
else:
|
|
|
|
|
return self.Get('os_install_disk_dev')
|
|
|
|
|
|
|
|
|
@ -1820,11 +1777,11 @@ class VariableOsInstallDiskPerformFormat(ReadonlyVariable):
|
|
|
|
|
type = "bool-list"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
_format = list(map(lambda x: x[2],
|
|
|
|
|
filter(lambda x: x[0].startswith('/dev/') and x[1],
|
|
|
|
|
zip(self.Get('os_location_source'),
|
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
|
self.Get('os_location_perform_format')))))
|
|
|
|
|
_format = [x[2] for x
|
|
|
|
|
in zip(self.Get('os_location_source'),
|
|
|
|
|
self.Get('os_location_dest'),
|
|
|
|
|
self.Get('os_location_perform_format'))
|
|
|
|
|
if x[0].startswith('/dev/') and x[1]]
|
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
|
efiformat = ['on' for x in self.Get('os_install_uefi')]
|
|
|
|
|
res = efiformat + _format
|
|
|
|
@ -1880,9 +1837,7 @@ class VariableOsInstallDiskName(Variable):
|
|
|
|
|
else:
|
|
|
|
|
return diskLabel.get(dev, '')
|
|
|
|
|
|
|
|
|
|
return list(map(changeLabel,
|
|
|
|
|
self.ZipVars('os_install_disk_dev',
|
|
|
|
|
'os_install_disk_mount')))
|
|
|
|
|
return list(map(changeLabel, self.ZipVars('os_install_disk_dev','os_install_disk_mount')))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskSize(SourceReadonlyVariable):
|
|
|
|
@ -2118,7 +2073,7 @@ class VariableOsInstallUefi(LocationHelper, Variable):
|
|
|
|
|
return self.select('os_device_efi',
|
|
|
|
|
os_device_dev=efidev, limit=1) or efidev
|
|
|
|
|
return efidev
|
|
|
|
|
return list(filter(lambda x: x != "off", map(transform, value)))
|
|
|
|
|
return [x for x in map(transform, value) if x != "off"]
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
deviceParentMap = self.ZipVars('os_device_dev',
|
|
|
|
@ -2233,7 +2188,7 @@ class VariableOsInstallMbr(LocationHelper, Variable):
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
|
# support off value
|
|
|
|
|
return list(filter(lambda x: x != "off", value))
|
|
|
|
|
return [x for x in value if x != "off"]
|
|
|
|
|
|
|
|
|
|
def check(self, value):
|
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
|