--- /dev/null
+[.config]
+enable=env:initrd
+
+[main]
+no-auto-default=*
# called by dracut
depends() {
+ echo dbus
return 0
}
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
+
+ inst "$dbussystem"/org.freedesktop.NetworkManager.conf
+ inst_multiple nmcli nm-online
+
+ # Install a configuration snippet to prevent the automatic creation of
+ # "Wired connection #" DHCP connections for Ethernet interfaces
+ inst_simple "$moddir"/initrd-no-auto-default.conf /usr/lib/NetworkManager/conf.d/
+
+ inst_simple "$moddir"/nm-initrd.service "$systemdsystemunitdir"/nm-initrd.service
+ inst_simple "$moddir"/nm-wait-online-initrd.service "$systemdsystemunitdir"/nm-wait-online-initrd.service
+
+ $SYSTEMCTL -q --root "$initdir" enable nm-initrd.service
fi
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
# shellcheck disable=SC2174
mkdir -m 0755 -p /run/NetworkManager/conf.d
(
+ echo '[.config]'
+ echo 'enable=env:initrd'
+ echo
echo '[logging]'
echo 'level=TRACE'
) > /run/NetworkManager/conf.d/initrd-logging.conf
--- /dev/null
+[Unit]
+DefaultDependencies=no
+Wants=systemd-udev-settle.service
+After=systemd-udev-settle.service
+Before=network.target
+ConditionPathExists=/run/NetworkManager/initrd/neednet
+ConditionPathExistsGlob=|/usr/lib/NetworkManager/system-connections/*
+ConditionPathExistsGlob=|/run/NetworkManager/system-connections/*
+ConditionPathExistsGlob=|/etc/NetworkManager/system-connections/*
+ConditionPathExistsGlob=|/etc/sysconfig/network-scripts/ifcfg-*
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.NetworkManager
+ExecReload=/usr/bin/busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager Reload u 0
+ExecStart=/usr/sbin/NetworkManager --debug
+KillMode=process
+StandardOutput=tty
+Environment=NM_CONFIG_ENABLE_TAG=initrd
+Restart=on-failure
+ProtectSystem=true
+ProtectHome=read-only
+
+[Install]
+WantedBy=initrd.target
+Also=nm-wait-online-initrd.service
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
echo '[ -f /tmp/nm.done ]' > "$hookdir"/initqueue/finished/nm.sh
- : > /run/NetworkManager/initrd/neednet # activate nm-run.service
+ : > /run/NetworkManager/initrd/neednet # activate NM services
break
done
fi
--- /dev/null
+[Unit]
+DefaultDependencies=no
+Requires=nm-initrd.service
+After=nm-initrd.service
+Before=network-online.target
+Before=dracut-initqueue.service
+ConditionPathExists=/run/NetworkManager/initrd/neednet
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/nm-online -s -q
+RemainAfterExit=yes
+Environment=NM_ONLINE_TIMEOUT=3600
+
+[Install]
+WantedBy=initrd.target
+WantedBy=network-online.target