nixos/deploy-rs: Start container if not running on deploy

This commit is contained in:
Jack O'Sullivan 2022-06-11 17:04:38 +01:00
parent 502b96996a
commit d2deabc6b2

View File

@ -58,7 +58,8 @@ let
path = pkgs.deploy-rs.lib.activate.custom ctrConfig.my.buildAs.container ''
source ${systemdUtil}/bin/systemd-util.sh
${if c.hotReload then ''
if systemctl show -p StatusText systemd-nspawn@${n} | grep -q "Dummy container"; then
if (! systemctl show -p ActiveState systemd-nspawn@${n} | grep -q "ActiveState=active") || \
systemctl show -p StatusText systemd-nspawn@${n} | grep -q "Dummy container"; then
action=restart
else
action=reload