diff --git a/pyanaconda/modules/storage/bootloader/efi.py b/pyanaconda/modules/storage/bootloader/efi.py index ba9a5bf8b9c..2734aa63f1b 100644 --- a/pyanaconda/modules/storage/bootloader/efi.py +++ b/pyanaconda/modules/storage/bootloader/efi.py @@ -225,6 +225,11 @@ def efi_config_file(self): """ Full path to EFI configuration file. """ return join_paths(self.efi_config_dir, self._config_file) + def check(self): + """Verify the bootloader configuration.""" + # Force the resolution order to run the systemd-boot check. + return SystemdBoot.check(self) and EFIBase.check(self) + def write_config(self): """ Write the config settings to config file (ex: grub.cfg) not needed for systemd. """ config_path = join_paths(conf.target.system_root, self.efi_config_file) diff --git a/pyanaconda/modules/storage/bootloader/systemd.py b/pyanaconda/modules/storage/bootloader/systemd.py index ca84e8d112b..11c800882e7 100644 --- a/pyanaconda/modules/storage/bootloader/systemd.py +++ b/pyanaconda/modules/storage/bootloader/systemd.py @@ -15,7 +15,8 @@ # License and may only be used or replicated with the express permission of # Red Hat, Inc. # - +from pyanaconda.core.constants import PAYLOAD_TYPE_DNF +from pyanaconda.modules.common.constants.services import PAYLOADS from pyanaconda.modules.storage.bootloader.base import BootLoader, BootLoaderError from pyanaconda.core import util from pyanaconda.core.configuration.anaconda import conf @@ -75,6 +76,30 @@ def config_file(self): """ Full path to configuration file. """ return "%s/%s" % (self.config_dir, self._config_file) + + def check(self): + """Verify the bootloader configuration.""" + if self._get_payload_type() != PAYLOAD_TYPE_DNF: + self.errors.append(_( + "Systemd-boot cannot be utilized with the current type of payload. " + "Choose an installation media that supports package installation." + )) + return False + + return super().check() + + @staticmethod + def _get_payload_type(): + """Get the type of the active payload.""" + payloads_proxy = PAYLOADS.get_proxy() + object_path = payloads_proxy.ActivePayload + + if not object_path: + return None + + object_proxy = PAYLOADS.get_proxy(object_path) + return object_proxy.Type + # copy console update from grub2.py def write_config_console(self, config): log.info("systemd.py: write_config_console") @@ -153,14 +178,5 @@ def install(self, args=None): raise BootLoaderError(_("bootctl failed to install UEFI boot loader. " "More information may be found in the log files stored in /tmp")) - def write_config_images(self, config): return True - - def is_valid_stage1_device(self, device, early=False): - valid = True - if conf.system.provides_liveuser: - raise BootLoaderError("systemd-boot cannot be utilized on live media with grub.") - else: - valid = super().is_valid_stage1_device(device, early) - return valid