From 221f24d6ff388ee851dcd64a93aa9d992d8c63e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B8=D1=80=D0=B5=D1=86=D0=BA=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Tue, 10 Oct 2017 16:42:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8=20--uefi=20=D0=B8=20--mbr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Перенесена проверка на одновременное использование --uefi --mbr из uncompatible в check * Добавлена проверка корректности выбора --mbr* * Исправлена список для выбора для GUI --- pym/install/variables/disk.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/pym/install/variables/disk.py b/pym/install/variables/disk.py index 5989b0c..1bff032 100644 --- a/pym/install/variables/disk.py +++ b/pym/install/variables/disk.py @@ -1976,12 +1976,13 @@ class VariableOsInstallUefi(LocationHelper, Variable): return self.select('os_device_efi', os_device_dev=efidev, limit=1) or efidev return efidev - return map(transform, value) + return filter(lambda x: x != "off", 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 + deviceParentMap = self.ZipVars('os_device_dev', + 'os_device_efi', 'os_device_name') + return [(efidisk, "%s (%s)" % (name or _("Unknown"), dev)) + for dev, efidisk, name in deviceParentMap if efidisk] def check(self, value): @@ -2045,12 +2046,12 @@ class VariableOsInstallMbr(LocationHelper, Variable): """ Disks for boot mbr """ - type = "choice-list" + type = "choiceedit-list" element = "selecttable" opt = ["--mbr"] metavalue = "MBR" untrusted = True - check_after = ["os_install_uefi_set"] + check_after = ["os_install_uefi"] def init(self): self.label = _("Boot disk") @@ -2082,7 +2083,7 @@ class VariableOsInstallMbr(LocationHelper, Variable): def choice(self): deviceParentMap = self.ZipVars('os_device_mbr', 'os_device_name') - return [(mbrdisk, name or _("Unknown")) + return [(mbrdisk, "%s (%s)" % (name or _("Unknown"), mbrdisk)) for mbrdisk, name in deviceParentMap if mbrdisk] @@ -2091,15 +2092,15 @@ class VariableOsInstallMbr(LocationHelper, Variable): return filter(lambda x: x != "off", value) def check(self, value): - if self.Get('cl_autopartition_set') == "on": + if self.GetBool('cl_autopartition_set'): return rootType = self.Get('os_install_root_type') if rootType == "flash": if len(value) > 1: raise VariableError( _("For Flash install, you need only one disk")) - if self.Get('os_install_uefi_set') == 'on': - return + if value and self.Get('os_install_uefi_set') == "on": + raise VariableError(_("MBR is not used with the UEFI bootloader")) useBtrfs = "btrfs" in self.Select('os_install_disk_format', where='os_install_disk_mount', _in=('/', '/boot'), @@ -2143,6 +2144,10 @@ class VariableOsInstallMbr(LocationHelper, Variable): _("Your boot device must have a BIOS Boot " "partition ({minsize})").format( minsize=minsize)) + if mbrDisk not in self.Get('os_device_mbr'): + raise VariableError( + _("Device {device} has not BIOS Boot partition").format( + device=mbrDisk)) if value: if not self.Get('os_grub2_path'): self.checkForLegacyGrub() @@ -2169,8 +2174,6 @@ class VariableOsInstallMbr(LocationHelper, Variable): """ Опция несовместима с использованием UEFI """ - if self.Get('os_install_uefi_set') == "on" and self.Get(): - return _("MBR is not used with the UEFI bootloader") if self.Get('cl_autopartition_set') == "on": return \ _("The layout is not available with autopartitioning")