Skip to content

Commit

Permalink
Merge pull request #5297 from poncovka/fedora-39-check_sdboot_support
Browse files Browse the repository at this point in the history
storage: Allow systemd-boot only for package installations
  • Loading branch information
KKoukiou committed Nov 6, 2023
2 parents 5ce882f + a22e3ea commit e1ac735
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
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
28 changes: 26 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,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")
Expand Down Expand Up @@ -147,6 +172,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

0 comments on commit e1ac735

Please sign in to comment.