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