17094c
From b692dbc7f2c6a3fb4fa587d9d63b80e4626dafae Mon Sep 17 00:00:00 2001
17094c
From: Beniamino Galvani <bgalvani@redhat.com>
17094c
Date: Wed, 11 Mar 2020 09:40:50 +0100
17094c
Subject: [PATCH] network-manager: ensure that nm-run.sh is executed when
17094c
 needed
17094c
17094c
The network-manager command line hook must install a
17094c
initqueue/finished hook to ensure that nm-run.sh is executed when
17094c
there are network connections to activate.
17094c
17094c
Fixes: #694
17094c
(cherry picked from commit 3dcaa97ca4dcfa8092252a22df62c60941e59ce3)
17094c
17094c
Resolves: #1826061
17094c
---
17094c
 modules.d/35network-manager/nm-config.sh | 11 +++++++++++
17094c
 modules.d/35network-manager/nm-run.sh    |  2 ++
17094c
 2 files changed, 13 insertions(+)
17094c
17094c
diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh
17094c
index 1efa737c..39a1c8bd 100755
17094c
--- a/modules.d/35network-manager/nm-config.sh
17094c
+++ b/modules.d/35network-manager/nm-config.sh
17094c
@@ -5,3 +5,14 @@ if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
17094c
 fi
17094c
 
17094c
 /usr/libexec/nm-initrd-generator -- $(getcmdline)
17094c
+
17094c
+if getargbool 0 rd.neednet; then
17094c
+  for i in /usr/lib/NetworkManager/system-connections/* \
17094c
+           /run/NetworkManager/system-connections/* \
17094c
+           /etc/NetworkManager/system-connections/* \
17094c
+           /etc/sysconfig/network-scripts/ifcfg-*; do
17094c
+    [ -f "$i" ] || continue
17094c
+    echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
17094c
+    break
17094c
+  done
17094c
+fi
17094c
diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
17094c
index 4079b735..fc5280a1 100755
17094c
--- a/modules.d/35network-manager/nm-run.sh
17094c
+++ b/modules.d/35network-manager/nm-run.sh
17094c
@@ -22,3 +22,5 @@ do
17094c
     source_hook initqueue/online $ifname
17094c
     /sbin/netroot $ifname
17094c
 done
17094c
+
17094c
+> /tmp/nm.done
17094c