From 83c32ac346c43e9c69a3eb248818e2ca7588a4ac Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 10 Oct 2023 09:57:18 +0200 Subject: [PATCH] Add generic network package valid for all flavors Signed-off-by: Itxaka --- packages/dracut/kairos-network/build.yaml | 7 ++++ .../dracut/kairos-network/collection.yaml | 5 +++ .../files/90-kairos-network.conf} | 2 +- .../files/90kairos-network/module-setup.sh | 42 +++++++++++++++++++ .../dracut/network-legacy-compat/build.yaml | 5 --- .../network-legacy-compat/collection.yaml | 4 -- .../conf/90-kairos-network-legacy-compat.conf | 2 - packages/dracut/network-legacy/build.yaml | 5 --- .../dracut/network-legacy/collection.yaml | 4 -- 9 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 packages/dracut/kairos-network/build.yaml create mode 100644 packages/dracut/kairos-network/collection.yaml rename packages/dracut/{network-legacy/conf/90-kairos-network-legacy.conf => kairos-network/files/90-kairos-network.conf} (52%) create mode 100644 packages/dracut/kairos-network/files/90kairos-network/module-setup.sh delete mode 100644 packages/dracut/network-legacy-compat/build.yaml delete mode 100644 packages/dracut/network-legacy-compat/collection.yaml delete mode 100644 packages/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf delete mode 100644 packages/dracut/network-legacy/build.yaml delete mode 100644 packages/dracut/network-legacy/collection.yaml diff --git a/packages/dracut/kairos-network/build.yaml b/packages/dracut/kairos-network/build.yaml new file mode 100644 index 000000000..7349bce31 --- /dev/null +++ b/packages/dracut/kairos-network/build.yaml @@ -0,0 +1,7 @@ +image: alpine +package_dir: "/package" +steps: +- mkdir -p /package/etc/dracut.conf.d +- mkdir -p /package/usr/lib/dracut/modules.d/ +- cp files/90-kairos-network.conf /package/etc/dracut.conf.d/90-kairos-network.conf +- cp -r files/90kairos-network /package/usr/lib/dracut/modules.d/90kairos-network diff --git a/packages/dracut/kairos-network/collection.yaml b/packages/dracut/kairos-network/collection.yaml new file mode 100644 index 000000000..e6b7ac587 --- /dev/null +++ b/packages/dracut/kairos-network/collection.yaml @@ -0,0 +1,5 @@ +packages: +- name: "kairos-network" + category: "dracut" + version: "1.0.0" + description: "package for initramfs network modules" diff --git a/packages/dracut/network-legacy/conf/90-kairos-network-legacy.conf b/packages/dracut/kairos-network/files/90-kairos-network.conf similarity index 52% rename from packages/dracut/network-legacy/conf/90-kairos-network-legacy.conf rename to packages/dracut/kairos-network/files/90-kairos-network.conf index d99578b22..082840272 100644 --- a/packages/dracut/network-legacy/conf/90-kairos-network-legacy.conf +++ b/packages/dracut/kairos-network/files/90-kairos-network.conf @@ -1,2 +1,2 @@ omit_dracutmodules+=" systemd-networkd " -add_dracutmodules+=" network-legacy " \ No newline at end of file +add_dracutmodules+=" kairos-network " \ No newline at end of file diff --git a/packages/dracut/kairos-network/files/90kairos-network/module-setup.sh b/packages/dracut/kairos-network/files/90kairos-network/module-setup.sh new file mode 100644 index 000000000..b33662f6f --- /dev/null +++ b/packages/dracut/kairos-network/files/90kairos-network/module-setup.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# This module selects the proper network module to be used by dracut +# while avoiding using systemd-networkd +# This helps it be more generic and work on all kairos flavors easily without having +# to specify the network module directly in our framework packages list + +# 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/packages/dracut/network-legacy-compat/build.yaml b/packages/dracut/network-legacy-compat/build.yaml deleted file mode 100644 index caee2cd0c..000000000 --- a/packages/dracut/network-legacy-compat/build.yaml +++ /dev/null @@ -1,5 +0,0 @@ -image: alpine -package_dir: "/package" -steps: -- mkdir -p /package/etc/dracut.conf.d -- cp -rfv conf/* /package/etc/dracut.conf.d diff --git a/packages/dracut/network-legacy-compat/collection.yaml b/packages/dracut/network-legacy-compat/collection.yaml deleted file mode 100644 index 3a241152c..000000000 --- a/packages/dracut/network-legacy-compat/collection.yaml +++ /dev/null @@ -1,4 +0,0 @@ -packages: -- name: "network-legacy-compat" - category: "dracut" - version: "0.9" diff --git a/packages/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf b/packages/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf deleted file mode 100644 index 328ef74a8..000000000 --- a/packages/dracut/network-legacy-compat/conf/90-kairos-network-legacy-compat.conf +++ /dev/null @@ -1,2 +0,0 @@ -omit_dracutmodules+=" systemd-networkd " -add_dracutmodules+=" network " \ No newline at end of file diff --git a/packages/dracut/network-legacy/build.yaml b/packages/dracut/network-legacy/build.yaml deleted file mode 100644 index caee2cd0c..000000000 --- a/packages/dracut/network-legacy/build.yaml +++ /dev/null @@ -1,5 +0,0 @@ -image: alpine -package_dir: "/package" -steps: -- mkdir -p /package/etc/dracut.conf.d -- cp -rfv conf/* /package/etc/dracut.conf.d diff --git a/packages/dracut/network-legacy/collection.yaml b/packages/dracut/network-legacy/collection.yaml deleted file mode 100644 index f46123d3c..000000000 --- a/packages/dracut/network-legacy/collection.yaml +++ /dev/null @@ -1,4 +0,0 @@ -packages: -- name: "network-legacy" - category: "dracut" - version: "0.9"