From bedc2a39792d0af05f80446af4806f7482c38327 Mon Sep 17 00:00:00 2001 From: Chemineer <144575703+chemineer1@users.noreply.github.com> Date: Sun, 27 Sep 2026 09:25:39 -0500 Subject: [PATCH] Keep shutdown worker on the same script path --- bin/omarchy-system-shutdown | 2 +- test/shell.d/system-power-test.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-system-shutdown b/bin/omarchy-system-shutdown index f65ac9e7..74b091f5 100755 --- a/bin/omarchy-system-shutdown +++ b/bin/omarchy-system-shutdown @@ -19,7 +19,7 @@ elif [[ ${1:-} == "--inhibit" ]]; then # Block lid handling explicitly: it ignores high-level sleep inhibitors. systemd-inhibit --what=sleep:idle:handle-lid-switch \ --who=Omarchy --why="Shutdown in progress" --mode=block \ - "$OMARCHY_PATH/bin/omarchy-system-shutdown" --inhibited || { + "$0" --inhibited || { status=$? omarchy-notification-send -u critical "Shutdown failed" "Could not complete shutdown. Please try again." exit "$status" diff --git a/test/shell.d/system-power-test.sh b/test/shell.d/system-power-test.sh index 027b8ad8..baad2b80 100755 --- a/test/shell.d/system-power-test.sh +++ b/test/shell.d/system-power-test.sh @@ -107,6 +107,15 @@ grep -q '^systemctl poweroff --no-wall$' "$CALL_LOG" || fail "poweroff runs afte ! grep -q '^omarchy-notification-send ' "$CALL_LOG" || fail "successful shutdown sends no failure notification" pass "shutdown stays inhibited through preparation and the poweroff request" +: >"$call_log" +rm -f "$CALL_LOG.grace" "$CALL_LOG.poweroff" +# Dev link/unlink can leave the user manager pointing at a removed checkout. +OMARCHY_PATH="$test_tmp/removed-checkout" bash "$CALL_LOG.worker" || fail "shutdown uses its own script when the service environment is stale" +[[ -f $CALL_LOG.poweroff ]] || fail "shutdown reaches poweroff with a stale service environment" +[[ ! -f $CALL_LOG.inhibited ]] || fail "shutdown releases inhibition with a stale service environment" +! grep -q '^omarchy-notification-send ' "$CALL_LOG" || fail "stale service environment sends no failure notification" +pass "shutdown uses its own script when the service environment is stale" + : >"$call_log" rm -f "$CALL_LOG.grace" "$CALL_LOG.poweroff" BLOCK_WINDOW_CLOSE=true bash "$CALL_LOG.worker" || fail "shutdown proceeds while window closing is blocked"