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