Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for ESP if UEFI boot #2283

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 34 additions & 13 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 @@ -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"
Expand All @@ -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

Expand Down