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

sdboot: forward port content from PR#5297 #5458

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions pyanaconda/modules/storage/bootloader/efi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 25 additions & 2 deletions pyanaconda/modules/storage/bootloader/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -75,6 +76,29 @@ 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")
Expand Down Expand Up @@ -153,6 +177,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
Loading