diff options
Diffstat (limited to 'modules.d/35network-manager/nm-lib.sh')
-rwxr-xr-x | modules.d/35network-manager/nm-lib.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh new file mode 100755 index 0000000..32a288d --- /dev/null +++ b/modules.d/35network-manager/nm-lib.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +type getcmdline > /dev/null 2>&1 || . /lib/dracut-lib.sh + +nm_generate_connections() { + rm -f /run/NetworkManager/system-connections/* + if [ -x /usr/libexec/nm-initrd-generator ]; then + # shellcheck disable=SC2046 + /usr/libexec/nm-initrd-generator -- $(getcmdline) + elif [ -x /usr/lib/nm-initrd-generator ]; then + # shellcheck disable=SC2046 + /usr/lib/nm-initrd-generator -- $(getcmdline) + else + warn "nm-initrd-generator not found" + fi + + if getargbool 0 rd.neednet; then + 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 + mkdir -p "$hookdir"/initqueue/finished + echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh + mkdir -p /run/NetworkManager/initrd + : > /run/NetworkManager/initrd/neednet # activate NM services + break + done + fi +} + +nm_reload_connections() { + [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active nm-initrd.service && nmcli connection reload +} |