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