diff --git a/install/variables/disk.py b/install/variables/disk.py index 97cb014..ef0f9e2 100644 --- a/install/variables/disk.py +++ b/install/variables/disk.py @@ -29,6 +29,7 @@ from calculate.lib.utils.device import (getUdevDeviceInfo,getDeviceType, getPartitionType,getPartitionDevice,getRaidPartitions, getLvmPartitions,getPartitionSize, humanreadableSize, getUUIDDict,getCommonDeviceName) +from calculate.install.variables.autopartition import Sizes from calculate.lib.utils.files import (listDirectory,pathJoin,readFile,FStab, isMount) from calculate.install.distr import PartitionDistributive @@ -1682,6 +1683,10 @@ class VariableOsInstallMbr(LocationHelper,Variable): _("For Flash install, you need only one disk")) if self.Get('os_install_uefi_set') == 'on': return + useBtrfs = "btrfs" in self.Select('os_install_disk_format', + where='os_install_disk_mount', + _in=('/','/boot'), + sort="DESC")[:1] for mbrDisk in value: if self.Get('cl_autopartition_set') == 'on': tableOnBootDisk = self.Get('cl_autopartition_table') @@ -1696,12 +1701,27 @@ class VariableOsInstallMbr(LocationHelper,Variable): if tableOnBootDisk == "gpt": raise VariableError(_("You need a disk with a dos " "table for Flash install")) + if tableOnBootDisk == "dos" and useBtrfs: + raise VariableError(_("You need a disk with a gpt " + "table for install on btrfs")) if rootType in ("usb-hdd","hdd") and tableOnBootDisk == "gpt": - bios_grub = self.Select('os_disk_parent', - where='os_disk_id',eq='EF02') - if not mbrDisk in bios_grub: + efisize = self.Select('os_disk_size', + where=['os_disk_id','os_disk_parent'], + func=lambda os_disk_id,os_disk_parent:( + os_disk_id == 'EF02' and os_disk_parent == mbrDisk), + limit=1) + if not efisize: raise VariableError( _("Disk %s must have a 'bios_grub' partition")%mbrDisk) + # проверка размера EF02 при установке на btrfs + elif useBtrfs: + bios_grub_size = self.Get('cl_autopartition_bios_grub_size') + if (efisize.isdigit() and bios_grub_size.isdigit() and + int(efisize) < int(bios_grub_size)): + raise VariableError( + _("Disk {diskname} must have a 'bios_grub' " + "partition with size at least {size}Mb").format( + diskname=mbrDisk,size=int(bios_grub_size)/Sizes.M)) if value: if self.Get('os_grub2_path'): self.checkForGrub2() @@ -1709,12 +1729,14 @@ class VariableOsInstallMbr(LocationHelper,Variable): self.checkForLegacyGrub() def checkForGrub2(self): - """Check current disk configuration for installation for install - GRUB2""" + """ + Проверить текущую конфигурацию диска для установки GRUB2 + """ grubDiskType=self.Select('os_install_disk_parent', where='os_install_disk_mount', _in=('/','/boot'), sort="DESC",limit=1) + if "lvm-raid" in grubDiskType: raise VariableError( _("Grub does not support booting from a RAID assembled from a LVM")