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