Encapsulate FAT filesystem detection in FilesystemType.is_fat()
This commit is contained in:
parent
70a9797774
commit
a7a193be50
|
|
@ -3,9 +3,7 @@ from enum import Enum, auto
|
|||
from pathlib import Path
|
||||
|
||||
from archinstall.lib.models.bootloader import Bootloader, BootloaderConfiguration
|
||||
from archinstall.lib.models.device import DiskLayoutConfiguration, FilesystemType
|
||||
|
||||
_FAT_FILESYSTEMS = (FilesystemType.FAT12, FilesystemType.FAT16, FilesystemType.FAT32)
|
||||
from archinstall.lib.models.device import DiskLayoutConfiguration
|
||||
|
||||
|
||||
class BootloaderValidationFailureKind(Enum):
|
||||
|
|
@ -39,7 +37,7 @@ def validate_bootloader_layout(
|
|||
|
||||
# Limine reads its config and kernels from the boot partition, which
|
||||
# must be FAT.
|
||||
if boot_part and boot_part.fs_type not in _FAT_FILESYSTEMS:
|
||||
if boot_part and (boot_part.fs_type is None or not boot_part.fs_type.is_fat()):
|
||||
return BootloaderValidationFailure(
|
||||
kind=BootloaderValidationFailureKind.LimineNonFatBoot,
|
||||
description='Limine does not support booting with a non-FAT boot partition.',
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ class DeviceHandler:
|
|||
case FilesystemType.EXT2 | FilesystemType.EXT3 | FilesystemType.EXT4:
|
||||
# Force create
|
||||
options.append('-F')
|
||||
case FilesystemType.FAT12 | FilesystemType.FAT16 | FilesystemType.FAT32:
|
||||
case _ if fs_type.is_fat():
|
||||
mkfs_type = 'fat'
|
||||
# Set FAT size
|
||||
options.extend(('-F', fs_type.value.removeprefix(mkfs_type)))
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from archinstall.lib.mirror.mirror_menu import MirrorMenu
|
|||
from archinstall.lib.models.application import ApplicationConfiguration, ZramConfiguration
|
||||
from archinstall.lib.models.authentication import AuthenticationConfiguration
|
||||
from archinstall.lib.models.bootloader import Bootloader, BootloaderConfiguration
|
||||
from archinstall.lib.models.device import DiskLayoutConfiguration, DiskLayoutType, FilesystemType, PartitionModification
|
||||
from archinstall.lib.models.device import DiskLayoutConfiguration, DiskLayoutType, PartitionModification
|
||||
from archinstall.lib.models.locale import LocaleConfiguration
|
||||
from archinstall.lib.models.mirrors import MirrorConfiguration
|
||||
from archinstall.lib.models.network import NetworkConfiguration, NicType
|
||||
|
|
@ -487,7 +487,7 @@ class GlobalMenu(AbstractMenu[None]):
|
|||
if efi_partition is None:
|
||||
return 'EFI system partition (ESP) not found'
|
||||
|
||||
if efi_partition.fs_type not in [FilesystemType.FAT12, FilesystemType.FAT16, FilesystemType.FAT32]:
|
||||
if efi_partition.fs_type is None or not efi_partition.fs_type.is_fat():
|
||||
return 'ESP must be formatted as a FAT filesystem'
|
||||
|
||||
if bootloader == Bootloader.Refind and not self._uefi:
|
||||
|
|
|
|||
|
|
@ -802,6 +802,9 @@ class FilesystemType(StrEnum):
|
|||
def is_crypto(self) -> bool:
|
||||
return self == FilesystemType.CRYPTO_LUKS
|
||||
|
||||
def is_fat(self) -> bool:
|
||||
return self in (FilesystemType.FAT12, FilesystemType.FAT16, FilesystemType.FAT32)
|
||||
|
||||
@property
|
||||
def parted_value(self) -> str:
|
||||
return self.value + '(v1)' if self == FilesystemType.LINUX_SWAP else self.value
|
||||
|
|
|
|||
Loading…
Reference in New Issue