From d683faa558351327d987918d1e8b8f79886dc9cb Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 25 Aug 2026 03:17:27 +0200 Subject: [PATCH] Make Gjallar promotion restart the selected release --- deploy/deploy-yggdrasil.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/deploy/deploy-yggdrasil.sh b/deploy/deploy-yggdrasil.sh index dc1c271..d48f6e5 100644 --- a/deploy/deploy-yggdrasil.sh +++ b/deploy/deploy-yggdrasil.sh @@ -78,7 +78,9 @@ ln -sfn "$release" "$current.next" mv -Tf "$current.next" "$current" install -d -o gjallar -g gjallar -m 0750 "$state_root" systemctl daemon-reload -if ! systemctl enable --now gjallar-yggdrasil.service || ! systemctl is-active --quiet gjallar-yggdrasil.service; then +if ! systemctl enable gjallar-yggdrasil.service || + ! systemctl restart gjallar-yggdrasil.service || + ! systemctl is-active --quiet gjallar-yggdrasil.service; then if [ -n "$previous" ] && [ -d "$previous" ]; then ln -sfn "$previous" "$current.next" mv -Tf "$current.next" "$current" @@ -87,6 +89,17 @@ if ! systemctl enable --now gjallar-yggdrasil.service || ! systemctl is-active - echo "Gjallar Yggdrasil activation failed." >&2 exit 1 fi +main_pid="$(systemctl show gjallar-yggdrasil.service -p MainPID --value)" +active_executable="$(readlink -f "/proc/$main_pid/exe" 2>/dev/null || true)" +if [ "$active_executable" != "$release/Gjallar" ]; then + if [ -n "$previous" ] && [ -d "$previous" ]; then + ln -sfn "$previous" "$current.next" + mv -Tf "$current.next" "$current" + systemctl restart gjallar-yggdrasil.service || true + fi + echo "Gjallar active executable does not match the selected release." >&2 + exit 1 +fi install -d -o root -g root -m 0755 /srv/gjallar/deploy cp "$release/deployment.env" /srv/gjallar/deploy/deployment.env