Skip to content

Commit

Permalink
Check for ESP if systemd-boot selected
Browse files Browse the repository at this point in the history
  • Loading branch information
codefiles committed Dec 3, 2023
1 parent f107104 commit 6ed7385
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -369,9 +381,16 @@ def _validate_bootloader(self) -> Optional[str]:
if boot_partition is None:
return "Boot 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"
match bootloader:
case Bootloader.Limine:
if boot_partition.fs_type != disk.FilesystemType.Fat32:
return "Limine does not support booting from filesystems other than FAT32"
case Bootloader.Systemd:
for layout in disk_config.device_modifications:
if layout.get_efi_partition():
break
else:
return "EFI system partition not found"

return None

Expand All @@ -382,8 +401,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

Expand Down

0 comments on commit 6ed7385

Please sign in to comment.