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 <noreply@anthropic.com>
This commit is contained in:
1 parent
d074092abd
commit
1165566ed9
1 file changed
+4
@@ -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 <seconds>: 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.
|
||||
|
||||
Reference in new issue
Block a user