From 1165566ed9385d1ce5b08208df3f5facd5d6db72 Mon Sep 17 00:00:00 2001 From: Nasim Sadat Date: Sat, 24 Oct 2026 00:39:40 +0200 Subject: [PATCH] deploy: run from / so sudo -u deploy works from a root shell `sudo -u deploy deploy.sh` (manual deploy, re-deploy, rollback) keeps root's working directory /root, which deploy cannot read; GNU find then fails in preflight and the run stops. Every path is absolute, so lib.sh now changes to / first. Co-Authored-By: Claude Opus 5.5 --- deploy/lib.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy/lib.sh b/deploy/lib.sh index f0cc28e..7d4ff5a 100644 --- a/deploy/lib.sh +++ b/deploy/lib.sh @@ -52,6 +52,10 @@ log() { printf '%s %s\n' "$(date -u +%H:%M:%S)" "$*" >&2; } die() { log "ERROR: $*"; exit 1; } [ "$(id -u)" != 0 ] || die "run as the deploy user (sudo -u deploy $0 ...), not as root" +# `sudo -u deploy` from a root shell keeps /root as the working directory, +# which deploy cannot read and GNU find refuses to start in. Every path here +# is absolute, so nothing needs the caller's directory. +cd / # acquire_lock : deploy.sh and rollback.sh share this lock, so a CI # deploy and a manual rollback never run at the same time. Held until exit.