fix: unattended sudo via temporary NOPASSWD drop-in with triple cleanup
Piping a password into ssh -tt's pty raced and hung on the real run (worked in a fast test, blocked for 14 min in practice). Replace with a temp /etc/sudoers.d/mac-setup installed by _install_sudoers.sh (validated before activation), removed on every exit path plus a 40-min on-Mac self-destruct. setup.sh now fails fast if passwordless sudo is absent instead of depending on a primed tty ticket. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-3
@@ -12,9 +12,7 @@ log(){ printf '\033[1;33m[%s]\033[0m %s\n' "$1" "$2"; }
|
||||
# ---------- preflight ----------
|
||||
[[ $(uname -m) == arm64 && $(sw_vers -productVersion) == 26.* ]] || { echo "not the Mac this was written for"; exit 1; }
|
||||
[[ ${HOSTNAME_WANT:-} ]] || { echo "HOSTNAME_WANT=<name> required"; exit 1; }
|
||||
sudo -v # ticket already primed by run.sh over the pty; prompts if run by hand
|
||||
( while true; do sudo -n true; sleep 50; done ) &
|
||||
KEEPALIVE=$!; trap 'kill $KEEPALIVE 2>/dev/null' EXIT
|
||||
sudo -n true 2>/dev/null || { echo "passwordless sudo unavailable — run via scripts/run.sh (it installs a temp drop-in)"; exit 1; }
|
||||
|
||||
# ---------- helpers ----------
|
||||
backup_domain(){ # once per domain per run
|
||||
|
||||
Reference in New Issue
Block a user