|
Harald Hoyer |
460d2c |
From 6e1e87cd2567801b10b2b4f716436c48688408bf Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
460d2c |
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
Harald Hoyer |
460d2c |
Date: Wed, 24 Jun 2020 13:06:05 +0200
|
|
Harald Hoyer |
460d2c |
Subject: [PATCH] network-manager: move connection generation to a lib file
|
|
Harald Hoyer |
460d2c |
|
|
Harald Hoyer |
460d2c |
Move the connection generation code to a library file so that it can
|
|
Harald Hoyer |
460d2c |
be reused from other places.
|
|
Harald Hoyer |
460d2c |
---
|
|
Harald Hoyer |
460d2c |
modules.d/35network-manager/module-setup.sh | 1 +
|
|
Harald Hoyer |
460d2c |
modules.d/35network-manager/nm-config.sh | 15 +++------------
|
|
Harald Hoyer |
460d2c |
modules.d/35network-manager/nm-lib.sh | 20 ++++++++++++++++++++
|
|
Harald Hoyer |
460d2c |
3 files changed, 24 insertions(+), 12 deletions(-)
|
|
Harald Hoyer |
460d2c |
|
|
Harald Hoyer |
460d2c |
diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh
|
|
Harald Hoyer |
460d2c |
index ad2a1534..ed2f399e 100755
|
|
Harald Hoyer |
460d2c |
--- a/modules.d/35network-manager/module-setup.sh
|
|
Harald Hoyer |
460d2c |
+++ b/modules.d/35network-manager/module-setup.sh
|
|
Harald Hoyer |
460d2c |
@@ -37,6 +37,7 @@ install() {
|
|
Harald Hoyer |
460d2c |
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
|
|
Harald Hoyer |
460d2c |
inst_rules 85-nm-unmanaged.rules
|
|
Harald Hoyer |
460d2c |
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
|
|
Harald Hoyer |
460d2c |
+ inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh"
|
|
Harald Hoyer |
460d2c |
|
|
Harald Hoyer |
460d2c |
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
|
|
Harald Hoyer |
460d2c |
inst /usr/libexec/nm-dhcp-helper
|
|
Harald Hoyer |
460d2c |
diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh
|
|
Harald Hoyer |
460d2c |
index 39a1c8bd..2b9df020 100755
|
|
Harald Hoyer |
460d2c |
--- a/modules.d/35network-manager/nm-config.sh
|
|
Harald Hoyer |
460d2c |
+++ b/modules.d/35network-manager/nm-config.sh
|
|
Harald Hoyer |
460d2c |
@@ -1,18 +1,9 @@
|
|
Harald Hoyer |
460d2c |
#!/bin/sh
|
|
Harald Hoyer |
460d2c |
|
|
Harald Hoyer |
460d2c |
+type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
|
|
Harald Hoyer |
460d2c |
+
|
|
Harald Hoyer |
460d2c |
if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
|
|
Harald Hoyer |
460d2c |
echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
|
|
Harald Hoyer |
460d2c |
fi
|
|
Harald Hoyer |
460d2c |
|
|
Harald Hoyer |
460d2c |
-/usr/libexec/nm-initrd-generator -- $(getcmdline)
|
|
Harald Hoyer |
460d2c |
-
|
|
Harald Hoyer |
460d2c |
-if getargbool 0 rd.neednet; then
|
|
Harald Hoyer |
460d2c |
- for i in /usr/lib/NetworkManager/system-connections/* \
|
|
Harald Hoyer |
460d2c |
- /run/NetworkManager/system-connections/* \
|
|
Harald Hoyer |
460d2c |
- /etc/NetworkManager/system-connections/* \
|
|
Harald Hoyer |
460d2c |
- /etc/sysconfig/network-scripts/ifcfg-*; do
|
|
Harald Hoyer |
460d2c |
- [ -f "$i" ] || continue
|
|
Harald Hoyer |
460d2c |
- echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
|
|
Harald Hoyer |
460d2c |
- break
|
|
Harald Hoyer |
460d2c |
- done
|
|
Harald Hoyer |
460d2c |
-fi
|
|
Harald Hoyer |
460d2c |
+nm_generate_connections
|
|
Harald Hoyer |
460d2c |
diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh
|
|
Harald Hoyer |
460d2c |
new file mode 100644
|
|
Harald Hoyer |
460d2c |
index 00000000..fe053cfa
|
|
Harald Hoyer |
460d2c |
--- /dev/null
|
|
Harald Hoyer |
460d2c |
+++ b/modules.d/35network-manager/nm-lib.sh
|
|
Harald Hoyer |
460d2c |
@@ -0,0 +1,20 @@
|
|
Harald Hoyer |
460d2c |
+#!/bin/bash
|
|
Harald Hoyer |
460d2c |
+
|
|
Harald Hoyer |
460d2c |
+type getcmdline >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
|
Harald Hoyer |
460d2c |
+
|
|
Harald Hoyer |
460d2c |
+nm_generate_connections()
|
|
Harald Hoyer |
460d2c |
+{
|
|
Harald Hoyer |
460d2c |
+ rm -f /run/NetworkManager/system-connections/*
|
|
Harald Hoyer |
460d2c |
+ /usr/libexec/nm-initrd-generator -- $(getcmdline)
|
|
Harald Hoyer |
460d2c |
+
|
|
Harald Hoyer |
460d2c |
+ if getargbool 0 rd.neednet; then
|
|
Harald Hoyer |
460d2c |
+ for i in /usr/lib/NetworkManager/system-connections/* \
|
|
Harald Hoyer |
460d2c |
+ /run/NetworkManager/system-connections/* \
|
|
Harald Hoyer |
460d2c |
+ /etc/NetworkManager/system-connections/* \
|
|
Harald Hoyer |
460d2c |
+ /etc/sysconfig/network-scripts/ifcfg-*; do
|
|
Harald Hoyer |
460d2c |
+ [ -f "$i" ] || continue
|
|
Harald Hoyer |
460d2c |
+ echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
|
|
Harald Hoyer |
460d2c |
+ break
|
|
Harald Hoyer |
460d2c |
+ done
|
|
Harald Hoyer |
460d2c |
+ fi
|
|
Harald Hoyer |
460d2c |
+}
|
|
Harald Hoyer |
460d2c |
|