Restrict UKI to supported options (#2280)
This commit is contained in:
parent
2aeb1b5762
commit
5db4456dba
|
|
@ -244,6 +244,9 @@ def load_config():
|
|||
if arguments.get('bootloader', None) is not None:
|
||||
arguments['bootloader'] = models.Bootloader.from_arg(arguments['bootloader'])
|
||||
|
||||
if arguments.get('uki') and not arguments['bootloader'].has_uki_support():
|
||||
arguments['uki'] = False
|
||||
|
||||
if arguments.get('audio_config', None) is not None:
|
||||
arguments['audio_config'] = models.AudioConfiguration.parse_arg(arguments['audio_config'])
|
||||
|
||||
|
|
|
|||
|
|
@ -218,14 +218,20 @@ class GlobalMenu(AbstractMenu):
|
|||
return False
|
||||
return self._validate_bootloader() is None
|
||||
|
||||
def _update_uki_display(self, name: Optional[str] = None):
|
||||
if bootloader := self._menu_options['bootloader'].current_selection:
|
||||
if not SysInfo.has_uefi() or not bootloader.has_uki_support():
|
||||
self._menu_options['uki'].set_current_selection(False)
|
||||
self._menu_options['uki'].set_enabled(False)
|
||||
elif name and name == 'bootloader':
|
||||
self._menu_options['uki'].set_enabled(True)
|
||||
|
||||
def _update_install_text(self, name: Optional[str] = None, value: Any = None):
|
||||
text = self._install_text()
|
||||
self._menu_options['install'].update_description(text)
|
||||
|
||||
def post_callback(self, name: Optional[str] = None, value: Any = None):
|
||||
if not SysInfo.has_uefi():
|
||||
self._menu_options['uki'].set_enabled(False)
|
||||
|
||||
self._update_uki_display(name)
|
||||
self._update_install_text(name, value)
|
||||
|
||||
def _install_text(self):
|
||||
|
|
@ -366,8 +372,6 @@ class GlobalMenu(AbstractMenu):
|
|||
if bootloader == Bootloader.Limine:
|
||||
if boot_partition.fs_type != disk.FilesystemType.Fat32:
|
||||
return "Limine does not support booting from filesystems other than FAT32"
|
||||
elif self._menu_options['uki'].current_selection:
|
||||
return "Limine does not support booting UKIs"
|
||||
|
||||
return None
|
||||
|
||||
|
|
|
|||
|
|
@ -907,19 +907,17 @@ class Installer:
|
|||
self,
|
||||
boot_partition: disk.PartitionModification,
|
||||
root_partition: disk.PartitionModification,
|
||||
efi_partition: Optional[disk.PartitionModification],
|
||||
uki_enabled: bool = False
|
||||
efi_partition: Optional[disk.PartitionModification]
|
||||
):
|
||||
self.pacman.strap('grub') # no need?
|
||||
|
||||
if not uki_enabled:
|
||||
grub_default = self.target / 'etc/default/grub'
|
||||
config = grub_default.read_text()
|
||||
grub_default = self.target / 'etc/default/grub'
|
||||
config = grub_default.read_text()
|
||||
|
||||
kernel_parameters = ' '.join(self._get_kernel_params(root_partition, False, False))
|
||||
config = re.sub(r'(GRUB_CMDLINE_LINUX=")("\n)', rf'\1{kernel_parameters}\2', config, 1)
|
||||
kernel_parameters = ' '.join(self._get_kernel_params(root_partition, False, False))
|
||||
config = re.sub(r'(GRUB_CMDLINE_LINUX=")("\n)', rf'\1{kernel_parameters}\2', config, 1)
|
||||
|
||||
grub_default.write_text(config)
|
||||
grub_default.write_text(config)
|
||||
|
||||
info(f"GRUB boot partition: {boot_partition.dev_path}")
|
||||
|
||||
|
|
@ -1234,7 +1232,7 @@ Exec = /bin/sh -c "{hook_command}"
|
|||
case Bootloader.Systemd:
|
||||
self._add_systemd_bootloader(boot_partition, root_partition, efi_partition, uki_enabled)
|
||||
case Bootloader.Grub:
|
||||
self._add_grub_bootloader(boot_partition, root_partition, efi_partition, uki_enabled)
|
||||
self._add_grub_bootloader(boot_partition, root_partition, efi_partition)
|
||||
case Bootloader.Efistub:
|
||||
self._add_efistub_bootloader(boot_partition, root_partition, uki_enabled)
|
||||
case Bootloader.Limine:
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ class Bootloader(Enum):
|
|||
Efistub = 'Efistub'
|
||||
Limine = 'Limine'
|
||||
|
||||
def has_uki_support(self) -> bool:
|
||||
match self:
|
||||
case Bootloader.Efistub | Bootloader.Systemd:
|
||||
return True
|
||||
case _:
|
||||
return False
|
||||
|
||||
def json(self) -> str:
|
||||
return self.value
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue