Blob Blame History Raw
From 02c096d138cc8c788daf5fae75408059cbc7e283 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 2 Dec 2019 02:19:51 +0100
Subject: [PATCH] network-manager: don't run NetworkManager when there are no
 connections

NetworkManager would unnecessarily bring up the devices, colliding with
further attempts to rename the devices.

This is arguably a NetworkManager bug and should eventually be fixed there.
Running NetworkManager without the connection is unnecessary regardless.

(cherry picked from commit 5965710e018989b02a56e8d190b71740ca3b5463)

Resolves: #1826061
---
 modules.d/35network-manager/nm-run.sh | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
index b33e0992..4079b735 100755
--- a/modules.d/35network-manager/nm-run.sh
+++ b/modules.d/35network-manager/nm-run.sh
@@ -1,10 +1,17 @@
 #!/bin/sh
 
-if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
-    /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
-else
-    /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
-fi
+for i in /usr/lib/NetworkManager/system-connections/* \
+         /run/NetworkManager/system-connections/* \
+         /etc/NetworkManager/system-connections/* \
+         /etc/sysconfig/network-scripts/ifcfg-*; do
+  [ -f "$i" ] || continue
+  if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
+      /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
+  else
+      /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
+  fi
+  break
+done
 
 for _i in /sys/class/net/*
 do