]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(systemd-networkd): remove default network if others were generated
authorBtbN <timo@rothenpieler.org>
Sun, 23 Jun 2024 23:40:25 +0000 (01:40 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Mon, 24 Jun 2024 22:06:21 +0000 (18:06 -0400)
dracut.sh
modules.d/01systemd-networkd/module-setup.sh
modules.d/01systemd-networkd/networkd-config.sh

index 22d45d5450381cf581d9a591e1aa48f443725ec4..856b884e96bcf9820b5b25cc51fd513620033419 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -2025,6 +2025,7 @@ if [[ $kernel_only != yes ]]; then
                 printf "%s\n" "systemdutildir=\"$systemdutildir\""
                 printf "%s\n" "systemdsystemunitdir=\"$systemdsystemunitdir\""
                 printf "%s\n" "systemdsystemconfdir=\"$systemdsystemconfdir\""
+                printf "%s\n" "systemdnetworkconfdir=\"$systemdnetworkconfdir\""
             } > "${initdir}"/etc/conf.d/systemd.conf
         fi
     fi
index bbd9e4a63c85d46cfb2c7a772f29d16ad9a383e5..007590b5a8f2d16e2e52adc12434f5a72265a059 100755 (executable)
@@ -63,7 +63,7 @@ install() {
         "$systemdsystemunitdir"/systemd-networkd-wait-online.service.d/99-dracut.conf
 
     inst_simple "$moddir"/99-default.network \
-        "$systemdnetworkconfdir"/99-default.network
+        "$systemdnetworkconfdir"/99-dracut-default.network
 
     inst_hook cmdline 99 "$moddir"/networkd-config.sh
     inst_hook initqueue/settled 99 "$moddir"/networkd-run.sh
index 809fc0eb0c87ff6e28f10ffadb4aecf5cb3bc0db..eb450c6eaa7f7e1b01dd10c60e9b193ca1c62c7f 100755 (executable)
@@ -18,6 +18,9 @@ for f in /run/systemd/network/*.network; do
         echo "[DHCPv6]"
         echo "RequestOptions=59 60"
     } >> "$f"
+
+    # Remove the default network if at least one was generated
+    rm -f "$systemdnetworkconfdir"/99-dracut-default.network
 done
 
 # Just in case networkd was already running