From eda60c486ff5e45ddfcb6a3ef4898281d142d9fa Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Oct 2023 10:27:23 +0200 Subject: [PATCH] Make kairos-sysext be generic enough to include on all flavors It will not install the systemd-sysext package if the binary is not there Signed-off-by: Itxaka --- packages/dracut/sysext/build.yaml | 5 ++-- packages/dracut/sysext/collection.yaml | 4 +-- .../dracut/sysext/conf/90-kairos-sysext.conf | 1 - .../dracut/sysext/files/90-kairos-sysext.conf | 1 + .../files/90kairos-sysext/module-setup.sh | 26 +++++++++++++++++++ 5 files changed, 32 insertions(+), 5 deletions(-) delete mode 100644 packages/dracut/sysext/conf/90-kairos-sysext.conf create mode 100644 packages/dracut/sysext/files/90-kairos-sysext.conf create mode 100644 packages/dracut/sysext/files/90kairos-sysext/module-setup.sh diff --git a/packages/dracut/sysext/build.yaml b/packages/dracut/sysext/build.yaml index 5602136aa..380f3304d 100644 --- a/packages/dracut/sysext/build.yaml +++ b/packages/dracut/sysext/build.yaml @@ -1,6 +1,7 @@ image: alpine package_dir: "/package" steps: -- mkdir -p /package/etc/systemd/network - mkdir -p /package/etc/dracut.conf.d -- cp -rfv conf/* /package/etc/dracut.conf.d +- mkdir -p /package/usr/lib/dracut/modules.d +- cp files/90-kairos-sysext.conf /package/etc/dracut.conf.d/90-kairos-sysext.conf +- cp -r files/90kairos-sysext /package/usr/lib/dracut/modules.d/90kairos-sysext diff --git a/packages/dracut/sysext/collection.yaml b/packages/dracut/sysext/collection.yaml index 19f07577d..1acd2a14a 100644 --- a/packages/dracut/sysext/collection.yaml +++ b/packages/dracut/sysext/collection.yaml @@ -1,4 +1,4 @@ packages: -- name: "sysext" +- name: "kairos-sysext" category: "dracut" - version: "0.9" + version: "1.0.0" diff --git a/packages/dracut/sysext/conf/90-kairos-sysext.conf b/packages/dracut/sysext/conf/90-kairos-sysext.conf deleted file mode 100644 index cf5a6ffae..000000000 --- a/packages/dracut/sysext/conf/90-kairos-sysext.conf +++ /dev/null @@ -1 +0,0 @@ -add_dracutmodules+=" systemd-sysext " diff --git a/packages/dracut/sysext/files/90-kairos-sysext.conf b/packages/dracut/sysext/files/90-kairos-sysext.conf new file mode 100644 index 000000000..0938eb06e --- /dev/null +++ b/packages/dracut/sysext/files/90-kairos-sysext.conf @@ -0,0 +1 @@ +add_dracutmodules+=" kairos-sysext " diff --git a/packages/dracut/sysext/files/90kairos-sysext/module-setup.sh b/packages/dracut/sysext/files/90kairos-sysext/module-setup.sh new file mode 100644 index 000000000..05438cd7e --- /dev/null +++ b/packages/dracut/sysext/files/90kairos-sysext/module-setup.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# This module tries to add systemd-sysext module to the initramfs if its in the system, otherwise it does nothing + +# called by dracut +check() { + # Return 255 to only include the module, if another module requires it. + return 255 +} + +# called by dracut +depends() { + # If the binary(s) requirements are not fulfilled the module can't be installed. + require_binaries systemd-sysext || return 1 + echo "systemd-sysext" + return 0 +} + +# called by dracut +installkernel() { + return 0 +} + +# called by dracut +install() { + return 0 +}