networkd: only wait for network to be online if configured to do so
This commit is contained in:
parent
8758f476b3
commit
8f21e089a8
|
@ -8,6 +8,8 @@ let
|
|||
|
||||
cfg = config.systemd.network;
|
||||
|
||||
waitOnline = config.networking.waitForOnline;
|
||||
|
||||
checkLink = checkUnitConfig "Link" [
|
||||
(assertOnlyFields [
|
||||
"Description" "Alias" "MACAddressPolicy" "MACAddress" "NamePolicy" "Name"
|
||||
|
@ -699,9 +701,9 @@ in
|
|||
config = mkIf config.systemd.network.enable {
|
||||
|
||||
systemd.additionalUpstreamSystemUnits = [
|
||||
"systemd-networkd.service" "systemd-networkd-wait-online.service"
|
||||
"org.freedesktop.network1.busname"
|
||||
];
|
||||
"systemd-networkd.service"
|
||||
] ++ optional waitOnline "systemd-networkd-wait-online.service";
|
||||
|
||||
systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links
|
||||
// mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs
|
||||
|
@ -714,11 +716,11 @@ in
|
|||
restartTriggers = map (f: f.source) (unitFiles);
|
||||
};
|
||||
|
||||
systemd.services.systemd-networkd-wait-online = {
|
||||
systemd.services.systemd-networkd-wait-online = lib.mkIf waitOnline {
|
||||
wantedBy = [ "network-online.target" ];
|
||||
};
|
||||
|
||||
systemd.services."systemd-network-wait-online@" = {
|
||||
systemd.services."systemd-network-wait-online@" = lib.mkIf waitOnline {
|
||||
description = "Wait for Network Interface %I to be Configured";
|
||||
conflicts = [ "shutdown.target" ];
|
||||
requisite = [ "systemd-networkd.service" ];
|
||||
|
|
Loading…
Reference in a new issue