Merge pull request #76719 from flokli/containers-poweroff
nixos/containers: use machinectl poweroff
This commit is contained in:
commit
d6bbe6c0f5
@ -225,12 +225,6 @@ let
|
|||||||
fi
|
fi
|
||||||
${concatStringsSep "\n" (mapAttrsToList renderExtraVeth cfg.extraVeths)}
|
${concatStringsSep "\n" (mapAttrsToList renderExtraVeth cfg.extraVeths)}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the leader PID so that we can signal it in
|
|
||||||
# preStop. We can't use machinectl there because D-Bus
|
|
||||||
# might be shutting down. FIXME: in systemd 219 we can
|
|
||||||
# just signal systemd-nspawn to do a clean shutdown.
|
|
||||||
machinectl show "$INSTANCE" | sed 's/Leader=\(.*\)/\1/;t;d' > "/run/containers/$INSTANCE.pid"
|
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -715,14 +709,7 @@ in
|
|||||||
|
|
||||||
postStart = postStartScript dummyConfig;
|
postStart = postStartScript dummyConfig;
|
||||||
|
|
||||||
preStop =
|
preStop = "machinectl poweroff $INSTANCE";
|
||||||
''
|
|
||||||
pid="$(cat /run/containers/$INSTANCE.pid)"
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
kill -RTMIN+4 "$pid"
|
|
||||||
fi
|
|
||||||
rm -f "/run/containers/$INSTANCE.pid"
|
|
||||||
'';
|
|
||||||
|
|
||||||
restartIfChanged = false;
|
restartIfChanged = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user