11import os
22import sys
33import time
4- from pathlib import Path
54
65from archinstall .lib .applications .application_handler import ApplicationHandler
76from archinstall .lib .args import ArchConfig , ArchConfigHandler
87from archinstall .lib .authentication .authentication_handler import AuthenticationHandler
8+ from archinstall .lib .bootloader .utils import validate_bootloader_layout
99from archinstall .lib .configuration import ConfigurationOutput
1010from archinstall .lib .disk .filesystem import FilesystemHandler
1111from archinstall .lib .disk .utils import disk_layouts
@@ -196,35 +196,6 @@ def perform_installation(
196196 pass
197197
198198
199- def _check_bootloader_layout (config : ArchConfig ) -> str | None :
200- """Validate bootloader configuration against disk layout.
201-
202- Returns an error message if the configuration would produce an
203- unbootable system, or None if it is valid.
204- """
205- # Limine can only read FAT. When the ESP is the boot partition but
206- # mounted outside /boot and UKI is disabled, the kernel ends up on the
207- # root filesystem which Limine cannot access.
208- if not (config .bootloader_config and config .bootloader_config .bootloader == Bootloader .Limine and not config .bootloader_config .uki and config .disk_config ):
209- return None
210-
211- efi_part = next (
212- (p for m in config .disk_config .device_modifications if (p := m .get_efi_partition ())),
213- None ,
214- )
215- boot_part = next (
216- (p for m in config .disk_config .device_modifications if (p := m .get_boot_partition ())),
217- None ,
218- )
219-
220- if efi_part and boot_part == efi_part and efi_part .mountpoint != Path ('/boot' ):
221- return (
222- f'Limine requires kernels on a FAT partition. The ESP is mounted at { efi_part .mountpoint } , '
223- 'enable UKI or add a separate /boot partition to install Limine.'
224- )
225- return None
226-
227-
228199def main (arch_config_handler : ArchConfigHandler | None = None ) -> None :
229200 if arch_config_handler is None :
230201 arch_config_handler = ArchConfigHandler ()
@@ -243,7 +214,10 @@ def main(arch_config_handler: ArchConfigHandler | None = None) -> None:
243214
244215 # Safety net for silent/config-file flow. The TUI menu blocks Install via
245216 # GlobalMenu._validate_bootloader() before reaching this point.
246- if err_msg := _check_bootloader_layout (arch_config_handler .config ):
217+ if err_msg := validate_bootloader_layout (
218+ arch_config_handler .config .bootloader_config ,
219+ arch_config_handler .config .disk_config ,
220+ ):
247221 error (err_msg )
248222 return
249223
0 commit comments