From af51e0cfa39e0312da665138714ee3af1710fc65 Mon Sep 17 00:00:00 2001 From: Mortdecai Date: Tue, 15 Sep 2026 19:36:56 -0400 Subject: [PATCH] fix: make SparkFun removal and launchd bootstrap non-fatal under set -e networksetup -removenetworkservice fails on the sole PPP-port service and aborted the whole run at exit 4 (before pmset/backup agent). Both it and the GUI-domain launchctl bootstrap (flaky over SSH) are now best-effort with a warn; the LaunchAgent plist auto-loads at next login regardless. Co-Authored-By: Claude Opus 4.8 --- docs/manual-checklist.md | 1 + scripts/setup.sh | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/manual-checklist.md b/docs/manual-checklist.md index 1374441..d5eb669 100644 --- a/docs/manual-checklist.md +++ b/docs/manual-checklist.md @@ -11,6 +11,7 @@ Do these once, in order, after `scripts/run.sh` has completed. Tick and date. - [ ] System Settings > Screen Time: App & Website Activity OFF. - [ ] System Settings > Spotlight: untick Siri Suggestions and any web/store result types; "Help Apple Improve Search" OFF. - [ ] System Settings > Notifications: Allow notifications when mirroring/sharing OFF (keeps popups off a projector). +- [ ] System Settings > Network: delete the stray **SparkFun Pro Micro** service if present (setup.sh can't — macOS refuses to remove the sole service on a PPP port). Harmless if left. ## DAW Focus - [ ] System Settings > Focus > "+" > Custom > name **DAW**, icon of your choice. Allowed notifications: none. "Share across devices" OFF. Toggle it from the menu-bar moon before a session. diff --git a/scripts/setup.sh b/scripts/setup.sh index 3e8da5b..11d81ad 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -112,9 +112,15 @@ if [[ "$dock_cur" == "${dock_want[*]} " ]]; then log skip "dock apps"; else log set "dock apps = ${dock_want[*]}"; CHANGED=1 fi -# ---------- stray network service ---------- +# ---------- stray network service (best-effort; never fatal) ---------- +# macOS refuses -removenetworkservice for the sole service on a PPP port ("parameters were not +# valid"), so this may not remove it. It's a harmless disconnected entry — warn and move on. if networksetup -listallnetworkservices | grep -qx 'SparkFun Pro Micro'; then - sudo networksetup -removenetworkservice 'SparkFun Pro Micro'; log set "removed SparkFun Pro Micro PPP service"; CHANGED=1 + if sudo networksetup -removenetworkservice 'SparkFun Pro Micro' 2>/dev/null; then + log set "removed SparkFun Pro Micro PPP service"; CHANGED=1 + else + log warn "could not remove SparkFun PPP service (macOS refuses; harmless — remove via Settings > Network if desired)" + fi else log skip "no SparkFun service"; fi # ---------- power (DAW) — AC profile only ---------- @@ -130,7 +136,11 @@ PL="$HOME/Library/LaunchAgents/xyz.sethpc.mac-backup.plist" if [[ -f $PL ]] && cmp -s "$REPO/config/xyz.sethpc.mac-backup.plist" "$PL"; then log skip "backup launchd agent"; else mkdir -p "$HOME/Library/LaunchAgents"; cp "$REPO/config/xyz.sethpc.mac-backup.plist" "$PL" launchctl bootout "gui/$(id -u)/xyz.sethpc.mac-backup" 2>/dev/null || true - launchctl bootstrap "gui/$(id -u)" "$PL"; log set "backup launchd agent (03:30 nightly)"; CHANGED=1 + # bootstrap into the GUI domain is flaky over SSH (no bound Aqua session); the plist in + # ~/Library/LaunchAgents auto-loads at next login regardless, so never let this abort setup. + if launchctl bootstrap "gui/$(id -u)" "$PL" 2>/dev/null; then log set "backup launchd agent loaded (03:30 nightly)" + else log warn "backup agent copied; bootstrap-over-SSH failed (normal) — loads at next login"; fi + CHANGED=1 fi # ---------- apply ----------