From edd11d43129f0f4a03a44ee76961784f0494ae8d Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 4 Jul 2026 11:48:39 +0200 Subject: [PATCH] fix: resolve shutdown-schedule canonical path via guardctl dynamically Hardcoding /usr/local/share/locked-shutdown-schedule.conf broke once the hosts/shutdown-schedule file-guard instances moved to guard-lib's own canonical-path layout. Resolve it at runtime via `guardctl file-guard canonical-path` instead, and fail loudly if the guard-lib instance isn't installed rather than silently reading/writing the wrong path. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01AFNiYQQgSLAkiBXswyimPq --- screen_locker/adjust_shutdown_schedule.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/screen_locker/adjust_shutdown_schedule.sh b/screen_locker/adjust_shutdown_schedule.sh index 4e6621e..fc69504 100755 --- a/screen_locker/adjust_shutdown_schedule.sh +++ b/screen_locker/adjust_shutdown_schedule.sh @@ -13,7 +13,13 @@ set -euo pipefail CONFIG_FILE="/etc/shutdown-schedule.conf" -CANONICAL_FILE="/usr/local/share/locked-shutdown-schedule.conf" +GUARD_NAME="shutdown-schedule" + +CANONICAL_FILE="$(guardctl file-guard canonical-path "$GUARD_NAME" 2>/dev/null || true)" +if [[ -z "$CANONICAL_FILE" ]]; then + echo "Error: guard-lib instance '$GUARD_NAME' is not installed (guardctl file-guard canonical-path returned empty)" >&2 + exit 1 +fi # Check for --restore flag RESTORE_MODE=false