treewide: deprecate ip-up.target (#18319)
Systemd upstream provides targets for networking. This also includes a target network-online.target. In this PR I remove / replace most occurrences since some of them were even wrong and could delay startup.
This commit is contained in:
parent
a28bbba6fc
commit
27bc34f1e4
|
@ -223,10 +223,10 @@ in
|
|||
# Install the proxy environment variables
|
||||
environment.sessionVariables = cfg.proxy.envVars;
|
||||
|
||||
# The ‘ip-up’ target is started when we have IP connectivity. So
|
||||
# services that depend on IP connectivity (like ntpd) should be
|
||||
# pulled in by this target.
|
||||
systemd.targets.ip-up.description = "Services Requiring IP Connectivity";
|
||||
# The ‘ip-up’ target is kept for backwards compatibility.
|
||||
# New services should use systemd upstream targets:
|
||||
# See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
|
||||
systemd.targets.ip-up.description = "Services Requiring IP Connectivity (deprecated)";
|
||||
|
||||
# This is needed when /etc/resolv.conf is being overriden by networkd
|
||||
# and other configurations. If the file is destroyed by an environment
|
||||
|
|
|
@ -61,7 +61,9 @@ with lib;
|
|||
services.avahi.enable = true;
|
||||
|
||||
systemd.services."4store-endpoint" = {
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
script = ''
|
||||
${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}'
|
||||
'';
|
||||
|
|
|
@ -53,7 +53,8 @@ with lib;
|
|||
services.avahi.enable = true;
|
||||
|
||||
systemd.services."4store" = {
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
preStart = ''
|
||||
mkdir -p ${stateDir}/
|
||||
|
|
|
@ -62,7 +62,8 @@ with lib;
|
|||
};
|
||||
|
||||
systemd.services.virtuoso = {
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
preStart = ''
|
||||
mkdir -p ${stateDir}
|
||||
|
|
|
@ -74,7 +74,8 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
systemd.services.freepopsd = {
|
||||
description = "Freepopsd (webmail over POP3)";
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
${pkgs.freepops}/bin/freepopsd \
|
||||
-p ${toString cfg.port} \
|
||||
|
|
|
@ -182,7 +182,8 @@ in
|
|||
|
||||
systemd.services.upsmon = {
|
||||
description = "Uninterruptible Power Supplies (Monitor)";
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "forking";
|
||||
script = "${pkgs.nut}/sbin/upsmon";
|
||||
environment.NUT_CONFPATH = "/etc/nut/";
|
||||
|
@ -191,8 +192,8 @@ in
|
|||
|
||||
systemd.services.upsd = {
|
||||
description = "Uninterruptible Power Supplies (Daemon)";
|
||||
after = [ "network.target" "upsmon.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-interfaces.target" "upsmon.service" ];
|
||||
serviceConfig.Type = "forking";
|
||||
# TODO: replace 'root' by another username.
|
||||
script = "${pkgs.nut}/sbin/upsd -u root";
|
||||
|
@ -202,8 +203,8 @@ in
|
|||
|
||||
systemd.services.upsdrv = {
|
||||
description = "Uninterruptible Power Supplies (Register all UPS)";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "upsd.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
# TODO: replace 'root' by another username.
|
||||
script = ''${pkgs.nut}/bin/upsdrvctl -u root start'';
|
||||
serviceConfig = {
|
||||
|
|
|
@ -53,9 +53,9 @@ let cfg = config.services.drbd; in
|
|||
};
|
||||
|
||||
systemd.services.drbd = {
|
||||
after = [ "systemd-udev.settle.service" ];
|
||||
after = [ "systemd-udev.settle.service" "network.target" ];
|
||||
wants = [ "systemd-udev.settle.service" ];
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
${pkgs.drbd}/sbin/drbdadm up all
|
||||
'';
|
||||
|
|
|
@ -59,7 +59,8 @@ in
|
|||
|
||||
systemd.services.amuled = {
|
||||
description = "AMule daemon";
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
preStart = ''
|
||||
mkdir -p ${cfg.dataDir}
|
||||
|
|
|
@ -61,7 +61,6 @@ let
|
|||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
# Hook for emitting ip-up/ip-down events.
|
||||
exitHook = pkgs.writeText "dhcpcd.exit-hook"
|
||||
''
|
||||
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
|
||||
|
@ -73,14 +72,8 @@ let
|
|||
# applies to openntpd.
|
||||
${config.systemd.package}/bin/systemctl try-restart ntpd.service
|
||||
${config.systemd.package}/bin/systemctl try-restart openntpd.service
|
||||
|
||||
${config.systemd.package}/bin/systemctl start ip-up.target
|
||||
fi
|
||||
|
||||
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
|
||||
# ${config.systemd.package}/bin/systemctl start ip-down.target
|
||||
#fi
|
||||
|
||||
${cfg.runHook}
|
||||
'';
|
||||
|
||||
|
|
|
@ -116,7 +116,8 @@ in
|
|||
};
|
||||
|
||||
systemd.services."git-daemon" = {
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = "${pkgs.git}/bin/git daemon --reuseaddr "
|
||||
+ (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
|
||||
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
|
||||
|
|
|
@ -106,7 +106,8 @@ in
|
|||
createIodineClientService = name: cfg:
|
||||
{
|
||||
description = "iodine client - ${name}";
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
RestartSec = "30s";
|
||||
Restart = "always";
|
||||
|
@ -121,7 +122,8 @@ in
|
|||
) // {
|
||||
iodined = mkIf (cfg.server.enable) {
|
||||
description = "iodine, ip over dns server daemon";
|
||||
wantedBy = [ "ip-up.target" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.ExecStart = "${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${cfg.server.ip} ${cfg.server.domain}";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -55,7 +55,6 @@ let
|
|||
ipUpScript = writeScript "01nixos-ip-up" ''
|
||||
#!/bin/sh
|
||||
if test "$2" = "up"; then
|
||||
${config.systemd.package}/bin/systemctl start ip-up.target
|
||||
${config.systemd.package}/bin/systemctl start network-online.target
|
||||
fi
|
||||
'';
|
||||
|
|
|
@ -677,8 +677,7 @@ in
|
|||
};
|
||||
|
||||
systemd.services.systemd-networkd-wait-online = {
|
||||
before = [ "ip-up.target" ];
|
||||
wantedBy = [ "network-online.target" "ip-up.target" ];
|
||||
wantedBy = [ "network-online.target" ];
|
||||
};
|
||||
|
||||
systemd.services."systemd-network-wait-online@" = {
|
||||
|
|
|
@ -142,7 +142,7 @@ in
|
|||
# (Flushing this interface may have removed it.)
|
||||
${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
|
||||
fi
|
||||
${config.systemd.package}/bin/systemctl start ip-up.target
|
||||
${config.systemd.package}/bin/systemctl start network-online.target
|
||||
'';
|
||||
preStop = flip concatMapStrings (ips) (ip:
|
||||
let
|
||||
|
|
|
@ -178,7 +178,8 @@ in
|
|||
|
||||
systemd.services.waagent = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "ip-up.target" "sshd.service" ];
|
||||
after = [ "network-online.target" "sshd.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
|
||||
path = [ pkgs.e2fsprogs ];
|
||||
description = "Windows Azure Agent Service";
|
||||
|
|
|
@ -116,8 +116,8 @@ in
|
|||
|
||||
wantedBy = [ "multi-user.target" "sshd.service" ];
|
||||
before = [ "sshd.service" ];
|
||||
wants = [ "ip-up.target" ];
|
||||
after = [ "ip-up.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
path = [ pkgs.wget pkgs.iproute ];
|
||||
|
||||
|
|
|
@ -134,8 +134,8 @@ in
|
|||
|
||||
wantedBy = [ "sshd.service" ];
|
||||
before = [ "sshd.service" ];
|
||||
after = [ "network-online.target" "ip-up.target" ];
|
||||
wants = [ "network-online.target" "ip-up.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
|
||||
script = let wget = "${pkgs.wget}/bin/wget --retry-connrefused -t 15 --waitretry=10 --header='Metadata-Flavor: Google'";
|
||||
mktemp = "mktemp --tmpdir=/run"; in
|
||||
|
|
Loading…
Reference in a new issue