
Decouple from a specific initrd generator (dracut) the systemd services that provide networking in the initrd using NM, thus allowing other systemd-based initrd generators to take advantage of it. These new services are: - `NetworkManager-config-initrd.service`: it starts very early at boot, parses the kernel command line using `nm-initrd-generator` and sets the `/run/NetworkManager/initrd/neednet` flag to activate the other initrd services, and also sets the hostname if needed. - `NetworkManager-initrd.service`: it basically does the same job as the `NetworkManager.service`, but in the initrd. - `NetworkManager-wait-online-initrd.service`: ordered before `network-online.target`, it will allow other services that require networking to delay their start until NM has finished.
33 lines
1.3 KiB
SYSTEMD
33 lines
1.3 KiB
SYSTEMD
[Unit]
|
|
Description=NetworkManager (initrd)
|
|
DefaultDependencies=no
|
|
Wants=systemd-udev-trigger.service network.target
|
|
After=systemd-udev-trigger.service network-pre.target dbus.service NetworkManager-config-initrd.service
|
|
Before=network.target
|
|
BindsTo=dbus.service
|
|
ConditionPathExists=/etc/initrd-release
|
|
ConditionPathExists=/run/NetworkManager/initrd/neednet
|
|
ConditionPathExistsGlob=|/usr/lib/NetworkManager/system-connections/*
|
|
ConditionPathExistsGlob=|/run/NetworkManager/system-connections/*
|
|
ConditionPathExistsGlob=|/etc/NetworkManager/system-connections/*
|
|
|
|
[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=@sbindir@/NetworkManager
|
|
# NM doesn't want systemd to kill its children for it
|
|
KillMode=process
|
|
Environment=NM_CONFIG_ENABLE_TAG=initrd
|
|
Restart=on-failure
|
|
ProtectSystem=true
|
|
ProtectHome=read-only
|
|
|
|
[Install]
|
|
WantedBy=initrd.target
|
|
# We want to enable NetworkManager-wait-online-initrd.service whenever this
|
|
# service is enabled. NetworkManager-wait-online-initrd.service has
|
|
# WantedBy=network-online.target, so enabling it only has an effect if
|
|
# network-online.target itself is enabled or pulled in by some other unit.
|
|
Also=NetworkManager-config-initrd.service NetworkManager-wait-online-initrd.service
|