d391a76354
Deployment now flows FROM the repo: install.sh replaces the loose hand-edited ~/.local/bin/bullpen-* copies with symlinks into the checked-out tree, so the running fleet == the repo and editing a "live copy" is editing the tracked file. Idempotent, reversible (pre-existing files -> .predeploy-bak). To update a host: git pull in the working copy. Closes the drift vector that hid a whole session of edits on one host. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWpfhDgYNA21tETDP9ueBE
44 lines
1.8 KiB
Bash
Executable File
44 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# deploy/install.sh — point this host's live bullpen entrypoints AT this working copy.
|
|
#
|
|
# The drift problem: the fleet used to run hand-edited loose copies in ~/.local/bin, which
|
|
# silently diverged from the repo (a whole session's edits could live only on one Pi). This
|
|
# replaces those loose copies with SYMLINKS into the checked-out repo, so:
|
|
# * the running fleet == the repo, always;
|
|
# * "editing the live script" IS "editing the tracked file" — drift becomes impossible;
|
|
# * to update a host: `git pull` in this working copy. That's the whole deploy.
|
|
#
|
|
# Idempotent and reversible: any pre-existing NON-symlink file is moved to <name>.predeploy-bak
|
|
# before the symlink is created. Re-running is safe. Run on any host that runs bullpen pieces.
|
|
set -euo pipefail
|
|
|
|
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
DEST="${HOME}/.local/bin"
|
|
mkdir -p "$DEST"
|
|
|
|
link() { # link <path-relative-to-repo> <name-in-DEST>
|
|
local src="$REPO/$1" name="$2" tgt="$DEST/$2"
|
|
[ -f "$src" ] || { echo " skip $name (no $1 in repo)"; return; }
|
|
if [ -L "$tgt" ] && [ "$(readlink -f "$tgt")" = "$(readlink -f "$src")" ]; then
|
|
echo " ok $name (already linked)"; return
|
|
fi
|
|
if [ -e "$tgt" ] && [ ! -L "$tgt" ]; then
|
|
mv -- "$tgt" "$tgt.predeploy-bak"
|
|
echo " bak $name -> $name.predeploy-bak"
|
|
fi
|
|
ln -sfn "$src" "$tgt"
|
|
echo " link $name -> $src"
|
|
}
|
|
|
|
echo "bullpen deploy: symlinking $DEST/<script> -> $REPO"
|
|
# every bin/bullpen-* entrypoint …
|
|
for f in "$REPO"/bin/bullpen-*; do
|
|
[ -e "$f" ] || continue
|
|
link "bin/$(basename "$f")" "$(basename "$f")"
|
|
done
|
|
# … plus the lurker (lives under lurker/, not bin/)
|
|
link "lurker/bullpen-lurker" "bullpen-lurker"
|
|
|
|
echo "done. running services pick up the new target on their next (re)start;"
|
|
echo "the scripts are byte-identical to what they already ran, so no restart is required."
|