mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-24 14:26:26 +01:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFNiYQQgSLAkiBXswyimPq
This commit is contained in:
parent
e25d806742
commit
edd11d4312
@ -13,7 +13,13 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
CONFIG_FILE="/etc/shutdown-schedule.conf"
|
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
|
# Check for --restore flag
|
||||||
RESTORE_MODE=false
|
RESTORE_MODE=false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user