From 974753f40809e341081912487ad6a7d03502a111 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Sun, 15 Oct 2023 17:28:11 +0200 Subject: [PATCH] Fix network module (#488) --- .../dracut/kairos-network/collection.yaml | 2 +- .../files/90-kairos-network.conf | 1 - .../files/90kairos-network/module-setup.sh | 33 +++++++++---------- .../{sysext => kairos-sysext}/build.yaml | 0 .../{sysext => kairos-sysext}/collection.yaml | 0 .../files/90-kairos-sysext.conf | 0 .../files/90kairos-sysext/module-setup.sh | 0 7 files changed, 17 insertions(+), 19 deletions(-) rename packages/dracut/{sysext => kairos-sysext}/build.yaml (100%) rename packages/dracut/{sysext => kairos-sysext}/collection.yaml (100%) rename packages/dracut/{sysext => kairos-sysext}/files/90-kairos-sysext.conf (100%) rename packages/dracut/{sysext => kairos-sysext}/files/90kairos-sysext/module-setup.sh (100%) diff --git a/packages/dracut/kairos-network/collection.yaml b/packages/dracut/kairos-network/collection.yaml index e6b7ac587..e49430bc0 100644 --- a/packages/dracut/kairos-network/collection.yaml +++ b/packages/dracut/kairos-network/collection.yaml @@ -1,5 +1,5 @@ packages: - name: "kairos-network" category: "dracut" - version: "1.0.0" + version: "1.1.0" description: "package for initramfs network modules" diff --git a/packages/dracut/kairos-network/files/90-kairos-network.conf b/packages/dracut/kairos-network/files/90-kairos-network.conf index 082840272..3eb035b51 100644 --- a/packages/dracut/kairos-network/files/90-kairos-network.conf +++ b/packages/dracut/kairos-network/files/90-kairos-network.conf @@ -1,2 +1 @@ -omit_dracutmodules+=" systemd-networkd " 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 index b33662f6f..bedd26fe4 100644 --- a/packages/dracut/kairos-network/files/90kairos-network/module-setup.sh +++ b/packages/dracut/kairos-network/files/90kairos-network/module-setup.sh @@ -1,33 +1,32 @@ #!/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 + # always include this module + return 0 } # 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 + # Network module: selects underlying network module (conman, networkmanager, network-legacy, systemd-networkd) + # network module needs to be installed for livenet module to work + # network-legacy just uses bash scripts to setup the network + # ubuntu-20 uses network + # ubuntu-22 uses network+network-legacy + # ubuntu-latest, debian, fedora,opensuse-*, almalinux, rockylinux uses network+network-legacy+systemd-networkd + # Im guessing we need the network module in the initramfs in case we set the rd.neednet=1 + # but that only affects conman, networkmanager and network-legacy? - if [ -z "$network_handler" ]; then - if check_module "network-legacy"; then - network_handler="network-legacy" - else - network_handler="network" - fi + # shellcheck disable=SC2144 + # add network-legacy module if it exists + if [ -d "${dracutbasedir}"/modules.d/??network-legacy ]; then + network_handler="network-legacy" fi - echo "kernel-network-modules $network_handler" + + echo "kernel-network-modules network $network_handler" return 0 } diff --git a/packages/dracut/sysext/build.yaml b/packages/dracut/kairos-sysext/build.yaml similarity index 100% rename from packages/dracut/sysext/build.yaml rename to packages/dracut/kairos-sysext/build.yaml diff --git a/packages/dracut/sysext/collection.yaml b/packages/dracut/kairos-sysext/collection.yaml similarity index 100% rename from packages/dracut/sysext/collection.yaml rename to packages/dracut/kairos-sysext/collection.yaml diff --git a/packages/dracut/sysext/files/90-kairos-sysext.conf b/packages/dracut/kairos-sysext/files/90-kairos-sysext.conf similarity index 100% rename from packages/dracut/sysext/files/90-kairos-sysext.conf rename to packages/dracut/kairos-sysext/files/90-kairos-sysext.conf diff --git a/packages/dracut/sysext/files/90kairos-sysext/module-setup.sh b/packages/dracut/kairos-sysext/files/90kairos-sysext/module-setup.sh similarity index 100% rename from packages/dracut/sysext/files/90kairos-sysext/module-setup.sh rename to packages/dracut/kairos-sysext/files/90kairos-sysext/module-setup.sh