Fix restart for prosody-component-register

Component registration would fail to clean up correctly, and would try
to incorrectly start when there's no need to do so.
This commit is contained in:
Alex Palaistras 2022-04-04 19:16:04 +01:00
parent 717bd2679c
commit 454b393805

View File

@ -9,6 +9,7 @@ RemainAfterExit=true
SyslogIdentifier=%N
Environment=PROSODY_COMPONENT_NAME=%i
EnvironmentFile=-%E/coreos-home-server/%i/%i.env
ExecCondition=/bin/sh -c "podman exec prosody prosodyctl shell host list | grep --quiet $PROSODY_COMPONENT_NAME; test $? -ne 0"
ExecStartPre=/bin/install --mode 0700 --directory /tmp/%N
ExecStartPre=/bin/sh -c "envsubst < %E/coreos-home-server/prosody/service/component.cfg.lua.template > /tmp/%N/component.cfg.lua"
ExecStartPre=/bin/podman cp --archive=false /tmp/%N/component.cfg.lua prosody:/etc/prosody/conf.d/%i.cfg.lua
@ -17,7 +18,7 @@ ExecStart=/bin/podman exec prosody prosodyctl shell host activate "$PROSODY_COMP
ExecStartPost=/bin/rm -Rf /tmp/%N
ExecStop=/bin/podman exec prosody prosodyctl shell host deactivate "$PROSODY_COMPONENT_NAME"
ExecStopPost=/bin/podman exec --user=root prosody rm -f /etc/prosody/conf.d/%i.cfg.lua
ExecStartPre=/bin/podman exec prosody prosodyctl shell config reload
ExecStopPost=/bin/podman exec prosody prosodyctl shell config reload
[Install]
WantedBy=multi-user.target