|
|
|
@ -870,21 +870,77 @@ class VariableOsLocationBriefData(LocationHelper, TableVariable):
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("Layout")
|
|
|
|
|
|
|
|
|
|
def get_autopartition(self, hr=HumanReadable.No):
|
|
|
|
|
# при авторазметке получаем только информацию о
|
|
|
|
|
# /boot/efi разделах
|
|
|
|
|
if self.GetBool('cl_autopartition_uefi_set'):
|
|
|
|
|
boot = [[dev, mp, fs, _format, size]
|
|
|
|
|
for dev, mp, fs, _format, size in self.ZipVars(
|
|
|
|
|
'os_install_disk_dev',
|
|
|
|
|
'os_install_disk_mount',
|
|
|
|
|
'os_install_disk_format',
|
|
|
|
|
'os_install_disk_perform_format',
|
|
|
|
|
'os_install_disk_size', humanreadable=hr)
|
|
|
|
|
if mp.startswith('/boot/efi')]
|
|
|
|
|
else:
|
|
|
|
|
boot = []
|
|
|
|
|
# исключаем из устройств авторазметки информацию о efi разделах
|
|
|
|
|
# так как она не достоверная
|
|
|
|
|
devices = [[dev, mp, fs, _format, size]
|
|
|
|
|
for dev, mp, fs, _format, size in self.ZipVars(
|
|
|
|
|
'cl_autopartition_disk_dev_full',
|
|
|
|
|
'cl_autopartition_disk_mount_full',
|
|
|
|
|
'cl_autopartition_disk_format_full',
|
|
|
|
|
'cl_autopartition_disk_perform_format_full',
|
|
|
|
|
'cl_autopartition_disk_size_full',
|
|
|
|
|
humanreadable=hr)
|
|
|
|
|
if not mp.startswith('/boot/efi')
|
|
|
|
|
]
|
|
|
|
|
binds = [[dev, mp, "", "", ""]
|
|
|
|
|
for dev, mp in self.ZipVars(
|
|
|
|
|
'cl_autopartition_bind_path',
|
|
|
|
|
'cl_autopartition_bind_mountpoint', humanreadable=hr)]
|
|
|
|
|
autodevs = self.Get('cl_autopartition_disk_dev_full')
|
|
|
|
|
bootdevs = [x[0] for x in boot]
|
|
|
|
|
|
|
|
|
|
def keysort(dev):
|
|
|
|
|
if dev in autodevs:
|
|
|
|
|
return autodevs.index(dev), -1
|
|
|
|
|
else:
|
|
|
|
|
return -1, bootdevs.index(dev)
|
|
|
|
|
|
|
|
|
|
return sorted(boot + devices,
|
|
|
|
|
key=lambda x: keysort(x[0])) + binds or [[]]
|
|
|
|
|
|
|
|
|
|
def get_manual(self, hr=HumanReadable.No):
|
|
|
|
|
devs = self.Get('os_disk_dev')
|
|
|
|
|
|
|
|
|
|
def keysort(dev):
|
|
|
|
|
if dev in devs:
|
|
|
|
|
return devs.index(dev), -1
|
|
|
|
|
else:
|
|
|
|
|
return -1, dev
|
|
|
|
|
|
|
|
|
|
devices = map(list, self.ZipVars(
|
|
|
|
|
'os_install_disk_dev',
|
|
|
|
|
'os_install_disk_mount',
|
|
|
|
|
'os_install_disk_format',
|
|
|
|
|
'os_install_disk_perform_format',
|
|
|
|
|
'os_install_disk_size',
|
|
|
|
|
humanreadable=hr))
|
|
|
|
|
|
|
|
|
|
binds = [[dev, mp, "", "", ""]
|
|
|
|
|
for dev, mp in self.ZipVars(
|
|
|
|
|
'os_install_bind_path',
|
|
|
|
|
'os_install_bind_mountpoint', humanreadable=hr)]
|
|
|
|
|
return sorted(devices,
|
|
|
|
|
key=lambda x: keysort(x[0])) + binds or [[]]
|
|
|
|
|
|
|
|
|
|
def get(self, hr=HumanReadable.No):
|
|
|
|
|
for varname, value in ifilter(lambda x: type(x[1]) != list,
|
|
|
|
|
imap(lambda x: (x, self.Get(x)),
|
|
|
|
|
ifilter(None,
|
|
|
|
|
chain(*self.orig_source)))):
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Source variable %s does not contain a list") % varname)
|
|
|
|
|
return list(
|
|
|
|
|
chain(*
|
|
|
|
|
map(lambda k: map(list,
|
|
|
|
|
izip_longest(
|
|
|
|
|
*map(lambda x: self.Get(x,
|
|
|
|
|
humanreadable=hr) if x else '',
|
|
|
|
|
k), fillvalue='')),
|
|
|
|
|
self.orig_source))) or [[]]
|
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
|
return self.get_autopartition(hr)
|
|
|
|
|
else:
|
|
|
|
|
return self.get_manual(hr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationData(LocationHelper, TableVariable):
|
|
|
|
@ -1772,9 +1828,9 @@ class VariableOsInstallDiskSize(SourceReadonlyVariable):
|
|
|
|
|
return {
|
|
|
|
|
dev: size for dev, size in chain(
|
|
|
|
|
self.ZipVars('os_disk_dev', 'os_disk_size'),
|
|
|
|
|
self.ZipVars('os_location_source', 'os_location_size'),
|
|
|
|
|
self.ZipVars('cl_autopartition_disk_dev_full',
|
|
|
|
|
'cl_autopartition_disk_size_full'),
|
|
|
|
|
self.ZipVars('os_location_source', 'os_location_size'))
|
|
|
|
|
'cl_autopartition_disk_size_full'))
|
|
|
|
|
}
|
|
|
|
|
else:
|
|
|
|
|
return {
|
|
|
|
@ -1784,14 +1840,26 @@ class VariableOsInstallDiskSize(SourceReadonlyVariable):
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def getMapHumanReadable(self):
|
|
|
|
|
return {
|
|
|
|
|
device.udev.get_devname(name=dev): size
|
|
|
|
|
for dev, size in chain(
|
|
|
|
|
zip(self.Get('os_disk_dev'),
|
|
|
|
|
self.Get('os_disk_size', humanreadable=True)),
|
|
|
|
|
zip(self.Get('os_location_source'),
|
|
|
|
|
self.Get('os_location_size', humanreadable=True)))
|
|
|
|
|
}
|
|
|
|
|
if self.GetBool("cl_autopartition_set"):
|
|
|
|
|
return {
|
|
|
|
|
dev: size for dev, size in chain(
|
|
|
|
|
self.ZipVars('os_disk_dev', 'os_disk_size',
|
|
|
|
|
humanreadable=True),
|
|
|
|
|
self.ZipVars('os_location_source', 'os_location_size',
|
|
|
|
|
humanreadable=True),
|
|
|
|
|
self.ZipVars('cl_autopartition_disk_dev_full',
|
|
|
|
|
'cl_autopartition_disk_size_full',
|
|
|
|
|
humanreadable=True))
|
|
|
|
|
}
|
|
|
|
|
else:
|
|
|
|
|
return {
|
|
|
|
|
device.udev.get_devname(name=dev): size
|
|
|
|
|
for dev, size in chain(
|
|
|
|
|
zip(self.Get('os_disk_dev'),
|
|
|
|
|
self.Get('os_disk_size', humanreadable=True)),
|
|
|
|
|
zip(self.Get('os_location_source'),
|
|
|
|
|
self.Get('os_location_size', humanreadable=True)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallDiskType(SourceReadonlyVariable):
|
|
|
|
|