From 7fa8fa680c92f7e5a729934e9817a85a9078e730 Mon Sep 17 00:00:00 2001 From: dalto Date: Sat, 2 Sep 2023 10:01:05 -0500 Subject: [PATCH] [initcpiocfg] Make using systemd hook optional --- src/modules/initcpiocfg/initcpiocfg.conf | 11 +++++++++++ src/modules/initcpiocfg/initcpiocfg.schema.yaml | 11 +++++++++++ src/modules/initcpiocfg/main.py | 9 ++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 src/modules/initcpiocfg/initcpiocfg.conf create mode 100644 src/modules/initcpiocfg/initcpiocfg.schema.yaml diff --git a/src/modules/initcpiocfg/initcpiocfg.conf b/src/modules/initcpiocfg/initcpiocfg.conf new file mode 100644 index 000000000..347aaee82 --- /dev/null +++ b/src/modules/initcpiocfg/initcpiocfg.conf @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# The initcpiocfg module is responsible for the configuration of mkinitcpio.conf. Typically this +# module is used in conjunction with the initcpio module to generate the boot image when using mkinitcpio +--- +# +# Determines if the systemd versions of the hooks should be used. This is false by default.mkinitcpio +# +# Please note that using the systemd hooks result in no access to the emergency recovery shell +# useSystemdHook: false \ No newline at end of file diff --git a/src/modules/initcpiocfg/initcpiocfg.schema.yaml b/src/modules/initcpiocfg/initcpiocfg.schema.yaml new file mode 100644 index 000000000..f071e79aa --- /dev/null +++ b/src/modules/initcpiocfg/initcpiocfg.schema.yaml @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2023 Evan James +# SPDX-License-Identifier: GPL-3.0-or-later +--- +$schema: https://json-schema.org/schema# +$id: https://calamares.io/schemas/initcpiocfg +additionalProperties: false +type: object +properties: + useSystemdHook: { type: boolean } + + diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 821d6e5ee..465a3dfcc 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -163,9 +163,12 @@ def find_initcpio_features(partitions, root_mount_point): "block", "keyboard", ] - uses_systemd = target_env_call(["sh", "-c", "which systemd-cat"]) == 0 - if uses_systemd: + systemd_hook_allowed = libcalamares.job.configuration.get("useSystemdHook", False) + + use_systemd = systemd_hook_allowed and target_env_call(["sh", "-c", "which systemd-cat"]) == 0 + + if use_systemd: hooks.insert(0, "systemd") hooks.append("sd-vconsole") else: @@ -224,7 +227,7 @@ def find_initcpio_features(partitions, root_mount_point): hooks.append("usr") if encrypt_hook: - if uses_systemd: + if use_systemd: hooks.append("sd-encrypt") else: hooks.append("encrypt")