inst /usr/libexec/nm-initrd-generator
inst_multiple -o teamd dhclient
inst_hook cmdline 99 "$moddir/nm-config.sh"
+ if dracut_module_included "systemd"; then
+ inst_simple "${moddir}/nm-run.service" "${systemdsystemunitdir}/nm-run.service"
+ $SYSTEMCTL -q --root "$initdir" enable nm-run.service
+ fi
+
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
+
inst_rules 85-nm-unmanaged.rules
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh"
--- /dev/null
+# This file is part of dracut.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+[Unit]
+#make sure all devices showed up
+Wants=systemd-udev-settle.service
+After=systemd-udev-settle.service
+
+#pull the network targets into transaction
+Wants=network.target network-online.target
+Before=network.target network-online.target
+
+#run before we try to mount anything from the dracut hooks
+Before=dracut-initqueue.service
+
+#do not run, if there is no configuration
+ConditionPathExistsGlob=|/usr/lib/NetworkManager/system-connections/*
+ConditionPathExistsGlob=|/run/NetworkManager/system-connections/*
+ConditionPathExistsGlob=|/etc/NetworkManager/system-connections/*
+ConditionPathExistsGlob=|/etc/sysconfig/network-scripts/ifcfg-*
+
+[Service]
+#run the script and wait before it finishes
+Type=oneshot
+ExecStart=/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
+
+[Install]
+WantedBy=initrd.target
#!/bin/sh
+type source_hook >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
if [ -e /tmp/nm.done ]; then
return
fi
+[ -z "$DRACUT_SYSTEMD" ] && \
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
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
-
- if [ -s /run/NetworkManager/initrd/hostname ]; then
- cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname
- fi
break
done
+if [ -s /run/NetworkManager/initrd/hostname ]; then
+ cat /run/NetworkManager/initrd/hostname > /proc/sys/kernel/hostname
+fi
+
for _i in /sys/class/net/*
do
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
fi
# Check: do we really know how to handle (net)root?
+ if [ -z "$root" ]; then
+ root=$(getarg root=)
+ fi
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"