|
|
|
@ -163,6 +163,7 @@ class VariableOsDeviceDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
Disk devices
|
|
|
|
|
"""
|
|
|
|
|
type = "list"
|
|
|
|
|
re_disk_raid = re.compile("^disk-.*-raid\d+$", re.I)
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
pass
|
|
|
|
@ -170,14 +171,13 @@ class VariableOsDeviceDev(DeviceHelper, ReadonlyVariable):
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get device /dev name"""
|
|
|
|
|
self.Get('os_device_invalidator')
|
|
|
|
|
diskraid = re.compile("^disk-.*-raid$", re.I)
|
|
|
|
|
|
|
|
|
|
# get devices from block sys directories(discard mem,sr,loop and other)
|
|
|
|
|
devices = (x for x in self.getBlockDevices() if x.count('/') == 2)
|
|
|
|
|
devnames = device.udev.syspath_to_devname(
|
|
|
|
|
x for x in devices
|
|
|
|
|
if device.udev.is_device(device.udev.get_device_info(x)) or
|
|
|
|
|
diskraid.match(device.udev.get_device_type(path=x)))
|
|
|
|
|
self.re_disk_raid.match(device.udev.get_device_type(path=x)))
|
|
|
|
|
|
|
|
|
|
return list(sorted((x for x in devnames),
|
|
|
|
|
key=self.separateDevice))
|
|
|
|
@ -592,6 +592,8 @@ class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
|
List type (lvm,raid,partition,disk)
|
|
|
|
|
"""
|
|
|
|
|
type = "list"
|
|
|
|
|
re_raid = re.compile("-raid\d+$")
|
|
|
|
|
re_raid_partition = re.compile("-raid\d+-partition$")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
"""Get partition scheme"""
|
|
|
|
@ -613,9 +615,9 @@ class VariableOsDiskType(ReadonlyVariable):
|
|
|
|
|
|
|
|
|
|
for dev, diskType in types:
|
|
|
|
|
prop = device.udev.get_device_info(name=dev)
|
|
|
|
|
if diskType.endswith("-raid"):
|
|
|
|
|
if self.re_raid.search(diskType):
|
|
|
|
|
raiddevice = prop.get('DEVPATH', '')
|
|
|
|
|
elif diskType.endswith("-raid-partition"):
|
|
|
|
|
elif self.re_raid_partition.search(diskType):
|
|
|
|
|
raiddevice = path.dirname(prop.get('DEVPATH', ''))
|
|
|
|
|
else:
|
|
|
|
|
raiddevice = None
|
|
|
|
@ -1021,6 +1023,11 @@ class VariableOsLocationSource(LocationHelper, DeviceHelper, Variable):
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Device '%s' is used more than once") % dupDevices[0])
|
|
|
|
|
|
|
|
|
|
class VariableClRootSizeMin(Variable):
|
|
|
|
|
"""
|
|
|
|
|
Минимальнй размер root раздела
|
|
|
|
|
"""
|
|
|
|
|
value_format = "{cl_autopartition_root_size_min}"
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
"""
|
|
|
|
@ -1093,11 +1100,12 @@ class VariableOsLocationDest(LocationHelper, Variable):
|
|
|
|
|
################################
|
|
|
|
|
# check size for root device
|
|
|
|
|
################################
|
|
|
|
|
minroot = int(self.Get('cl_root_size_min'))
|
|
|
|
|
osInstallRootType = self.Get('os_install_root_type')
|
|
|
|
|
if osInstallRootType != "flash" and \
|
|
|
|
|
not "/usr" in value:
|
|
|
|
|
for mp, size in filter(lambda x: x[0] == '/' and x[1].isdigit() and \
|
|
|
|
|
int(x[1]) < 7 * 1024 * 1024 * 1024,
|
|
|
|
|
int(x[1]) < minroot,
|
|
|
|
|
izip(value,
|
|
|
|
|
self.Get("os_location_size"))):
|
|
|
|
|
raise VariableError(
|
|
|
|
@ -1952,6 +1960,109 @@ class VariableOsInstallBootDevices(ReadonlyVariable):
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallUefi(LocationHelper, Variable):
|
|
|
|
|
"""
|
|
|
|
|
Disks for boot mbr
|
|
|
|
|
"""
|
|
|
|
|
type = "choiceedit-list"
|
|
|
|
|
element = "selecttable"
|
|
|
|
|
opt = ["--uefi"]
|
|
|
|
|
metavalue = "EFI"
|
|
|
|
|
|
|
|
|
|
re_not0_raid = re.compile("-raid[1-9]")
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
self.label = _("UEFI boot")
|
|
|
|
|
self.help = _("set UEFI boot disks")
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def install_to_not_x86_64(self):
|
|
|
|
|
return self.Get('os_install_arch_machine') != 'x86_64'
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def install_without_uefiboot(self):
|
|
|
|
|
return self.Get('os_uefi_set') == 'off'
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def install_to_flash(self):
|
|
|
|
|
return self.Get('os_install_root_type') == 'flash'
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
# если используется авторазметка список разделов находится в ней
|
|
|
|
|
if self.GetBool('cl_autopartition_set'):
|
|
|
|
|
return self.Get('cl_autopartition_efi')
|
|
|
|
|
# исключаем определение UEFI если оно не может быть использовано
|
|
|
|
|
if (self.install_to_flash or self.install_to_not_x86_64 or
|
|
|
|
|
self.install_without_uefiboot):
|
|
|
|
|
return []
|
|
|
|
|
# если происходит обновление загрузчика текущей системы
|
|
|
|
|
# для определения используем /etc/fstab
|
|
|
|
|
fstabefidevs = self.select('os_disk_dev',
|
|
|
|
|
os_disk_mount__startswith="/boot/efi")
|
|
|
|
|
if self.Get('cl_action') != 'system':
|
|
|
|
|
return fstabefidevs
|
|
|
|
|
rootdev = self.Get('os_install_root_dev')
|
|
|
|
|
rootscheme = self.select('os_disk_type',
|
|
|
|
|
os_disk_dev=rootdev, limit=1)
|
|
|
|
|
# определяем список физических дисков на которых находится rootdev
|
|
|
|
|
parents = set(self.select('os_disk_parent',
|
|
|
|
|
os_disk_dev=rootdev, limit=1).split(','))
|
|
|
|
|
efidev = [x for x in self.select('os_device_efi',
|
|
|
|
|
os_device_dev__in=parents) if x]
|
|
|
|
|
allefi = [x for x in self.select('os_device_efi',
|
|
|
|
|
os_device_type="hdd") if x]
|
|
|
|
|
# если корневое устройство расположено на ненулевом RAID - возвращаем
|
|
|
|
|
# полный список иначе только первое устройство
|
|
|
|
|
# если диски для установки не содержат EFI - берём efi из /etc/fstab
|
|
|
|
|
# если и там нет, то берём первый попавшийся EFI на любом из HDD
|
|
|
|
|
if self.re_not0_raid.search(rootscheme):
|
|
|
|
|
return efidev or fstabefidevs or allefi[:1]
|
|
|
|
|
# возвращаем первое найденное устройство
|
|
|
|
|
else:
|
|
|
|
|
return efidev[:1] or fstabefidevs or allefi[:1]
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
|
def transform(efidev):
|
|
|
|
|
if efidev not in self.Get('os_device_efi'):
|
|
|
|
|
return self.select('os_device_efi',
|
|
|
|
|
os_device_dev=efidev, limit=1) or efidev
|
|
|
|
|
return efidev
|
|
|
|
|
return map(transform, value)
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
deviceParentMap = self.ZipVars('os_device_efi', 'os_device_name')
|
|
|
|
|
return [(efidisk, name or _("Unknown"))
|
|
|
|
|
for efidisk, name in deviceParentMap
|
|
|
|
|
if efidisk]
|
|
|
|
|
|
|
|
|
|
def check(self, value):
|
|
|
|
|
if value:
|
|
|
|
|
if self.install_without_uefiboot:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Your system must be loaded in UEFI for using this "
|
|
|
|
|
"bootloader"))
|
|
|
|
|
if self.install_to_not_x86_64:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Architecture of the target system must be x86_64"))
|
|
|
|
|
efidevs = self.Get('os_device_efi')
|
|
|
|
|
badefi = [x for x in value if x not in efidevs]
|
|
|
|
|
if badefi:
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Wrong EFI device %s") % badefi[0])
|
|
|
|
|
|
|
|
|
|
def uncompatible(self):
|
|
|
|
|
"""
|
|
|
|
|
Uncompatible with autopartition
|
|
|
|
|
"""
|
|
|
|
|
if self.Get('cl_autopartition_set') == "on":
|
|
|
|
|
return \
|
|
|
|
|
_("The layout is not available with autopartitioning")
|
|
|
|
|
if self.Get('os_install_root_type') == 'flash':
|
|
|
|
|
return \
|
|
|
|
|
_("This option not used for Flash install")
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsInstallMbr(LocationHelper, Variable):
|
|
|
|
|
"""
|
|
|
|
|
Disks for boot mbr
|
|
|
|
|