From 46a26c5d6b56a95f4748ee35ecc07b58e1481d24 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Mon, 9 Oct 2023 16:03:19 +0200 Subject: [PATCH] [POC] Use a single network dracut package Signed-off-by: Itxaka --- Earthfile | 3 +++ framework-profile.yaml | 24 -------------------- kairos-network/module-setup.sh | 40 ++++++++++++++++++++++++++++++++++ net.conf | 2 ++ 4 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 kairos-network/module-setup.sh create mode 100644 net.conf diff --git a/Earthfile b/Earthfile index b22b8c808..3dc1d7774 100644 --- a/Earthfile +++ b/Earthfile @@ -281,6 +281,9 @@ framework: END END + COPY kairos-network /framework/usr/lib/dracut/modules.d/29kairos-network + RUN mkdir -p /framework/etc/dracut.conf.d + COPY net.conf /framework/etc/dracut.conf.d/10-kairos-network.conf SAVE ARTIFACT --keep-own /framework/ framework build-framework-image: diff --git a/framework-profile.yaml b/framework-profile.yaml index 300d6c23b..2d2c2c8ed 100755 --- a/framework-profile.yaml +++ b/framework-profile.yaml @@ -11,91 +11,74 @@ flavors: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy debian-arm-rpi: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy ubuntu: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy ubuntu-arm-rpi: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy ubuntu-20-lts-arm-nvidia-jetson-agx-orin: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat ubuntu-20-lts-arm-rpi: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat ubuntu-22-lts-arm-rpi: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat ubuntu-22-lts: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat ubuntu-20-lts: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat fips-systemd: - common-packages - kairos-toolchain-fips - systemd-base - - dracut-network-legacy-compat fedora: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat rockylinux: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat almalinux: - common-packages - kairos-toolchain - systemd-base - - dracut-network-legacy-compat opensuse-tumbleweed: - 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 - kairos-toolchain @@ -111,13 +94,6 @@ flavors: - kairos-toolchain - ubuntu-kernel - openrc -# See https://github.com/kairos-io/packages/pull/67 for rationale -dracut-network-legacy: - packages: - - dracut/network-legacy -dracut-network-legacy-compat: - packages: - - dracut/network-legacy-compat openrc: packages: - init-svc/openrc diff --git a/kairos-network/module-setup.sh b/kairos-network/module-setup.sh new file mode 100644 index 000000000..14f9644b6 --- /dev/null +++ b/kairos-network/module-setup.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# This module selects the proper network module to be used by dracut +# while avoiding using systemd-networkd + +# called by dracut +check() { + return 255 +} + +# called by dracut +depends() { + is_qemu_virtualized && echo -n "qemu-net " + + for module in network network-legacy; do + if dracut_module_included "$module"; then + network_handler="$module" + break + fi + done + + if [ -z "$network_handler" ]; then + if check_module "network-legacy"; then + network_handler="network-legacy" + else + network_handler="network" + fi + fi + echo "kernel-network-modules $network_handler" + return 0 +} + +# called by dracut +installkernel() { + return 0 +} + +# called by dracut +install() { + dracut_need_initqueue +} diff --git a/net.conf b/net.conf new file mode 100644 index 000000000..082840272 --- /dev/null +++ b/net.conf @@ -0,0 +1,2 @@ +omit_dracutmodules+=" systemd-networkd " +add_dracutmodules+=" kairos-network " \ No newline at end of file