Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/global_menu.py
diff options
context:
space:
mode:
authorAnhad Singh <62820092+Andy-Python-Programmer@users.noreply.github.com>2023-06-30 17:53:53 +1000
committerGitHub <noreply@github.com>2023-06-30 09:53:53 +0200
commita0e4e6ee7604419d58d80f22b0348df6e745d8c8 (patch)
tree8e5188e1ff229bfeb45ac2ad90e067698a06bf47 /archinstall/lib/global_menu.py
parentffb9366280803578bd47f2d7102a5772fc44caab (diff)
installer: add Limine bootloader (#1815)
* installer: add Limine bootloader Limine is a modern, advanced, portable, multiprotocol bootloader. [Limine GitHub](https://github.com/limine-bootloader/limine) [Limine Arch Wiki](https://wiki.archlinux.org/title/Limine) Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * limine: add UEFI support Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * global_menu: check filesystem and bootloader compatibility Before on install, only missing configurations were checked. This commit introduces bootloader validatity checks on install which verify if the selected filesystem is compatiable with the selected bootloader (for example, it is not possible to boot limine from BTRFS). Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * misc: fix the return value of `_validate_bootloader` Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * global_menu: make `mypy` happy Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * misc: make `flake8` happy Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * limine: upgrade to v5 Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * limine: install packman hooks Create the BIOS and UEFI pacman hooks so limine gets auto deployed on update. Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * installer::limine: fix broken root UUID Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * docs: add a note saying its in beta Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> * install_limine: use `safe_fs_type` Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com> --------- Signed-off-by: Anhad Singh <andypythonappdeveloper@gmail.com>
Diffstat (limited to 'archinstall/lib/global_menu.py')
-rw-r--r--archinstall/lib/global_menu.py44
1 files changed, 41 insertions, 3 deletions
diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py
index 54b30240..5a431010 100644
--- a/archinstall/lib/global_menu.py
+++ b/archinstall/lib/global_menu.py
@@ -169,8 +169,8 @@ class GlobalMenu(AbstractMenu):
self._menu_options['install'] = \
Selector(
self._install_text(),
- exec_func=lambda n, v: True if len(self._missing_configs()) == 0 else False,
- preview_func=self._prev_install_missing_config,
+ exec_func=lambda n, v: self._is_config_valid(),
+ preview_func=self._prev_install_invalid_config,
no_store=True)
self._menu_options['abort'] = Selector(_('Abort'), exec_func=lambda n,v:exit(1))
@@ -200,6 +200,14 @@ class GlobalMenu(AbstractMenu):
return list(missing)
+ def _is_config_valid(self) -> bool:
+ """
+ Checks the validity of the current configuration.
+ """
+ if len(self._missing_configs()) != 0:
+ return False
+ return self._validate_bootloader() is None
+
def _update_install_text(self, name: str, value: str):
text = self._install_text()
self._menu_options['install'].update_description(text)
@@ -321,12 +329,42 @@ class GlobalMenu(AbstractMenu):
return disk.EncryptionType.type_to_text(current_value.encryption_type)
return ''
- def _prev_install_missing_config(self) -> Optional[str]:
+ def _validate_bootloader(self) -> Optional[str]:
+ """
+ Checks the selected bootloader is valid for the selected filesystem
+ type of the boot partition.
+
+ Returns [`None`] if the bootloader is valid, otherwise returns a
+ string with the error message.
+ """
+ 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:
+ return "No disk layout selected"
+
+ if boot_partition is None:
+ return "Boot partition not found"
+
+ if bootloader == Bootloader.Limine and boot_partition.fs_type == disk.FilesystemType.Btrfs:
+ return "Limine bootloader does not support booting from BTRFS filesystem"
+
+ return None
+
+ def _prev_install_invalid_config(self) -> Optional[str]:
if missing := self._missing_configs():
text = str(_('Missing configurations:\n'))
for m in missing:
text += f'- {m}\n'
return text[:-1] # remove last new line
+
+ if error := self._validate_bootloader():
+ return f"Invalid configuration: {error}"
+
return None
def _prev_users(self) -> Optional[str]: