]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(cms): reload NetworkManager connections
authorBeniamino Galvani <bgalvani@redhat.com>
Wed, 4 Aug 2021 07:37:31 +0000 (09:37 +0200)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 9 Aug 2021 17:07:50 +0000 (17:07 +0000)
When NetworkManager is running as systemd service, it's not enough to write
connection files; the module should also tell NetworkManager to reload the
connections from disk so that any new connection can be auto-activated.

https://bugzilla.redhat.com/show_bug.cgi?id=1975929

modules.d/35network-manager/nm-lib.sh
modules.d/80cms/cmsifup.sh

index 2d27e079579597a121809c78102920b37fbd9c66..1f749587ad61978ad112d65585086bfd7e4dbbc6 100644 (file)
@@ -28,3 +28,7 @@ nm_generate_connections() {
         done
     fi
 }
+
+nm_reload_connections() {
+    [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active nm-initrd.service && nmcli connection reload
+}
index 73d76fbf29c6133c8a0e4585cff1973bab9875a0..285e20d121e7d61402185f1d2246f780573af9b0 100755 (executable)
@@ -37,6 +37,7 @@ echo "$IFACES" >> /tmp/net.ifaces
 if [ -x /usr/libexec/nm-initrd-generator ] || [ -x /usr/lib/nm-initrd-generator ]; then
     type nm_generate_connections > /dev/null 2>&1 || . /lib/nm-lib.sh
     nm_generate_connections
+    nm_reload_connections
 else
     exec ifup "$DEVICE"
 fi