Remove "wants" dependencies on <interface>.service

Instead it's enough to depend on
sys-subsystem-net-devices-<interface>.device, which in turn has a
"wants" dependency on the service (if any) that creates the interface.
This commit is contained in:
Eelco Dolstra 2012-10-10 22:47:50 -04:00
parent d7458b5fc2
commit bd1071d02b
2 changed files with 4 additions and 6 deletions

View file

@ -24,7 +24,7 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in
requires = [ "dev-vboxnetctl.device" ];
after = [ "dev-vboxnetctl.device" ];
before = [ "network-interfaces.service" ];
wantedBy = [ "multi-user.target" ];
wantedBy = [ "network.target" "sys-subsystem-net-devices-vboxnet0.device" ];
path = [ virtualbox ];
preStart =
''

View file

@ -287,9 +287,8 @@ in
configureInterface = i: nameValuePair "${i.name}-cfg"
{ description = "Configuration of ${i.name}";
wantedBy = [ "network.target" ];
wants = [ "${i.name}.service" ];
bindsTo = [ "sys-subsystem-net-devices-${i.name}.device" ];
after = [ "${i.name}.service" "sys-subsystem-net-devices-${i.name}.device" ];
after = [ "sys-subsystem-net-devices-${i.name}.device" ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
path = [ pkgs.iproute ];
@ -323,7 +322,7 @@ in
createTunDevice = i: nameValuePair "${i.name}"
{ description = "Virtual Network Interface ${i.name}";
wantedBy = [ "network.target" ];
wantedBy = [ "network.target" "sys-subsystem-net-devices-${i.name}.device" ];
serviceConfig =
{ Type = "oneshot";
RemainAfterExit = true;
@ -337,8 +336,7 @@ in
deps = map (i: "sys-subsystem-net-devices-${i}.device") v.interfaces;
in
{ description = "Bridge Interface ${n}";
wantedBy = [ "network.target" ];
wants = map (i: "${i}.service") v.interfaces;
wantedBy = [ "network.target" "sys-subsystem-net-devices-${n}.device" ];
bindsTo = deps;
after = deps;
serviceConfig.Type = "oneshot";