diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index e65915dbeb..6f9a5b01ad 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -210,13 +210,22 @@ def has_superuser() -> bool: return list(missing) + def _invalid_configs(self) -> List[str]: + errors = [] + + if error := self._validate_bootloader(): + errors.append(error) + + return errors + def _is_config_valid(self) -> bool: """ Checks the validity of the current configuration. """ - if len(self._missing_configs()) != 0: + if len(self._missing_configs()) or len(self._invalid_configs()): return False - return self._validate_bootloader() is None + + return True def _update_uki_display(self, name: Optional[str] = None): if bootloader := self._menu_options['bootloader'].current_selection: @@ -235,9 +244,12 @@ def post_callback(self, name: Optional[str] = None, value: Any = None): self._update_install_text(name, value) def _install_text(self): - missing = len(self._missing_configs()) - if missing > 0: + if missing := len(self._missing_configs()): return _('Install ({} config(s) missing)').format(missing) + + if invalid := len(self._invalid_configs()): + return _('Install ({} config(s) invalid)').format(invalid) + return _('Install') def _display_network_conf(self, config: Optional[NetworkConfiguration]) -> str: @@ -357,18 +369,24 @@ def _validate_bootloader(self) -> Optional[str]: shim if necessary. """ bootloader = self._menu_options['bootloader'].current_selection - boot_partition: Optional[disk.PartitionModification] = None - if disk_config := self._menu_options['disk_config'].current_selection: - for layout in disk_config.device_modifications: - if boot_partition := layout.get_boot_partition(): - break - else: + if not (disk_config := self._menu_options['disk_config'].current_selection): return "No disk layout selected" - if boot_partition is None: + for layout in disk_config.device_modifications: + if boot_partition := layout.get_boot_partition(): + break + else: return "Boot partition not found" + # An EFI system partition is mandatory for UEFI boot + if SysInfo.has_uefi(): + for layout in disk_config.device_modifications: + if layout.get_efi_partition(): + break + else: + return "EFI system partition not found" + if bootloader == Bootloader.Limine: if boot_partition.fs_type != disk.FilesystemType.Fat32: return "Limine does not support booting from filesystems other than FAT32" @@ -382,8 +400,11 @@ def _prev_install_invalid_config(self) -> Optional[str]: text += f'- {m}\n' return text[:-1] # remove last new line - if error := self._validate_bootloader(): - return str(_(f"Invalid configuration: {error}")) + if errors := self._invalid_configs(): + text = str(_('Invalid configurations:\n')) + for error in errors: + text += f'- {error}\n' + return text[:-1] # remove last new line return None