From d5fe09cccdabb98db2f21002919a8e39d973ddb2 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Oct 2023 10:31:43 +0200 Subject: [PATCH 1/4] POC: test kairos-sysext Signed-off-by: Itxaka --- 90-kairos-sysext.conf | 1 + 90kairos-sysext/module-setup.sh | 26 ++++++++++++++++++++++++++ Earthfile | 3 +++ framework-profile.yaml | 7 ------- 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 90-kairos-sysext.conf create mode 100644 90kairos-sysext/module-setup.sh diff --git a/90-kairos-sysext.conf b/90-kairos-sysext.conf new file mode 100644 index 000000000..0938eb06e --- /dev/null +++ b/90-kairos-sysext.conf @@ -0,0 +1 @@ +add_dracutmodules+=" kairos-sysext " diff --git a/90kairos-sysext/module-setup.sh b/90kairos-sysext/module-setup.sh new file mode 100644 index 000000000..05438cd7e --- /dev/null +++ b/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 +} diff --git a/Earthfile b/Earthfile index 10b346346..8cace0e64 100644 --- a/Earthfile +++ b/Earthfile @@ -281,6 +281,9 @@ framework: END END + COPY 90-kairos-sysext.conf /framework/etc/dracut.conf.d/90-kairos-sysext.conf + COPY 90kairos-sysext /framework/usr/lib/dracut/modules.d/90kairos-sysext + SAVE ARTIFACT --keep-own /framework/ framework build-framework-image: diff --git a/framework-profile.yaml b/framework-profile.yaml index 300d6c23b..6e1c12c9c 100755 --- a/framework-profile.yaml +++ b/framework-profile.yaml @@ -76,25 +76,21 @@ flavors: - common-packages - kairos-toolchain - systemd-base - - systemd-latest - dracut-network-legacy opensuse-tumbleweed-arm-rpi: - common-packages - kairos-toolchain - systemd-base - - systemd-latest - dracut-network-legacy opensuse-leap: - common-packages - kairos-toolchain - systemd-base - - systemd-latest - dracut-network-legacy opensuse-leap-arm-rpi: - common-packages - kairos-toolchain - systemd-base - - systemd-latest - dracut-network-legacy alpine-arm-rpi: - common-packages @@ -159,9 +155,6 @@ ubuntu-kernel: packages: - distro-kernels/ubuntu - distro-initrd/ubuntu -systemd-latest: - packages: - - dracut/sysext repositories: - &kairos name: "kairos" From 08d325877402637c553a48d8fbc4e6117912d192 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Oct 2023 10:36:11 +0200 Subject: [PATCH 2/4] Test the build for all flavors None should fail to build initrd even with the sysext module in there Signed-off-by: Itxaka --- .github/workflows/image-pr.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/image-pr.yaml b/.github/workflows/image-pr.yaml index 150d87912..bb2bd56dd 100644 --- a/.github/workflows/image-pr.yaml +++ b/.github/workflows/image-pr.yaml @@ -15,6 +15,31 @@ jobs: with: flavor: ubuntu + core-opensuse-tumbleweed: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: opensuse-tumbleweed + + core-alpine-ubuntu: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: alpine-ubuntu + + core-almalinux: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: almalinux + + core-fedora: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: fedora + + core-ubuntu-20-lts: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: ubuntu-20-lts + install: uses: ./.github/workflows/reusable-install-test.yaml with: From a2c5594563446da5faf9ae25634c3a614ea0308f Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Oct 2023 11:32:53 +0200 Subject: [PATCH 3/4] updated module Signed-off-by: Itxaka --- 90kairos-sysext/module-setup.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/90kairos-sysext/module-setup.sh b/90kairos-sysext/module-setup.sh index 05438cd7e..e5b22fe2d 100644 --- a/90kairos-sysext/module-setup.sh +++ b/90kairos-sysext/module-setup.sh @@ -3,16 +3,23 @@ # called by dracut check() { - # Return 255 to only include the module, if another module requires it. - return 255 + return 0 } # 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 + # Check if the module files exists + # This is not normal but on ubuntu-22 the binary for sysext exists but the dracut module doesnt, so we + # need to do further checks + files=( "${dracutbasedir}"/modules.d/??systemd-sysext ) + [ "${#files[@]}" -ge 2 ] && return 1 + if [ -d "${files[0]}" ]; then + echo "systemd-sysext" + return 0 + fi + return 1 } # called by dracut From c62d7d59c2a41c91f616474aaeaf0aa12fd89ffe Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Oct 2023 11:35:07 +0200 Subject: [PATCH 4/4] test all the flavors Signed-off-by: Itxaka --- .github/workflows/image-pr.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image-pr.yaml b/.github/workflows/image-pr.yaml index bb2bd56dd..8150fdfa8 100644 --- a/.github/workflows/image-pr.yaml +++ b/.github/workflows/image-pr.yaml @@ -19,16 +19,18 @@ jobs: uses: ./.github/workflows/reusable-build-flavor.yaml with: flavor: opensuse-tumbleweed - - core-alpine-ubuntu: + core-debian: uses: ./.github/workflows/reusable-build-flavor.yaml with: - flavor: alpine-ubuntu - + flavor: debian core-almalinux: uses: ./.github/workflows/reusable-build-flavor.yaml with: flavor: almalinux + core-rockylinux: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: rockylinux core-fedora: uses: ./.github/workflows/reusable-build-flavor.yaml @@ -40,6 +42,11 @@ jobs: with: flavor: ubuntu-20-lts + core-ubuntu-22-lts: + uses: ./.github/workflows/reusable-build-flavor.yaml + with: + flavor: ubuntu-22-lts + install: uses: ./.github/workflows/reusable-install-test.yaml with: