17094c
From 02c096d138cc8c788daf5fae75408059cbc7e283 Mon Sep 17 00:00:00 2001
17094c
From: Lubomir Rintel <lkundrak@v3.sk>
17094c
Date: Mon, 2 Dec 2019 02:19:51 +0100
17094c
Subject: [PATCH] network-manager: don't run NetworkManager when there are no
17094c
 connections
17094c
17094c
NetworkManager would unnecessarily bring up the devices, colliding with
17094c
further attempts to rename the devices.
17094c
17094c
This is arguably a NetworkManager bug and should eventually be fixed there.
17094c
Running NetworkManager without the connection is unnecessary regardless.
17094c
17094c
(cherry picked from commit 5965710e018989b02a56e8d190b71740ca3b5463)
17094c
17094c
Resolves: #1826061
17094c
---
17094c
 modules.d/35network-manager/nm-run.sh | 17 ++++++++++++-----
17094c
 1 file changed, 12 insertions(+), 5 deletions(-)
17094c
17094c
diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
17094c
index b33e0992..4079b735 100755
17094c
--- a/modules.d/35network-manager/nm-run.sh
17094c
+++ b/modules.d/35network-manager/nm-run.sh
17094c
@@ -1,10 +1,17 @@
17094c
 #!/bin/sh
17094c
 
17094c
-if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
17094c
-    /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
17094c
-else
17094c
-    /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
17094c
-fi
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
+  if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
17094c
+      /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
17094c
+  else
17094c
+      /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
17094c
+  fi
17094c
+  break
17094c
+done
17094c
 
17094c
 for _i in /sys/class/net/*
17094c
 do
17094c