Something went wrong. Try again.
My website. cameron.stream
Something went wrong. Try again.
Shell
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970#!/usr/bin/env bashset -euo pipefail
# Stable systemd entry point for the Cameron.site content worker. The deploy# checkout is intentionally separate from the human/agent development clone so# ordinary site work cannot make production reconciliation dirty or ahead.
umask 077
WORKER_REPO=${CAMERON_SITE_WORKER_REPO:-/home/cameron/.local/share/cameron-site/deploy-checkout}ORIGIN_URL=${CAMERON_SITE_ORIGIN_URL:-git@tangled.org:cameron.stream/3mjfhjorj6s22}STATE_DIR=${CAMERON_SITE_SYNC_STATE_DIR:-/home/cameron/.local/state/cameron-site}BOOTSTRAP_LOCK="$STATE_DIR/deploy-checkout.lock"
mkdir -p "$STATE_DIR" "$(dirname "$WORKER_REPO")"exec 8>"$BOOTSTRAP_LOCK"flock -n 8 || { echo "Another Cameron.site worker bootstrap is already running." exit 0}
if [[ -L "$WORKER_REPO" ]]; then echo "Refusing symlinked deploy checkout: $WORKER_REPO" exit 2fi
if [[ ! -e "$WORKER_REPO/.git" ]]; then if [[ -e "$WORKER_REPO" && -n $(find "$WORKER_REPO" -mindepth 1 -maxdepth 1 -print -quit) ]]; then echo "Refusing non-empty non-Git deploy checkout: $WORKER_REPO" exit 2 fi
temporary_checkout="${WORKER_REPO}.tmp.$$" rm -rf "$temporary_checkout" trap 'rm -rf "$temporary_checkout"' EXIT GIT_TERMINAL_PROMPT=0 git clone --single-branch --branch main "$ORIGIN_URL" "$temporary_checkout" rmdir "$WORKER_REPO" 2>/dev/null || true mv "$temporary_checkout" "$WORKER_REPO" trap - EXITfi
if [[ $(git -C "$WORKER_REPO" rev-parse --is-inside-work-tree 2>/dev/null || true) != true ]]; then echo "Deploy checkout is not a Git working tree: $WORKER_REPO" exit 2fi
actual_origin=$(git -C "$WORKER_REPO" remote get-url origin)if [[ "$actual_origin" != "$ORIGIN_URL" ]]; then echo "Deploy checkout origin mismatch." echo "Expected: $ORIGIN_URL" echo "Actual: $actual_origin" exit 2fi
if [[ $(git -C "$WORKER_REPO" branch --show-current) != main ]]; then echo "Deploy checkout must remain on main: $WORKER_REPO" exit 2fi
worker="$WORKER_REPO/scripts/sync-git-backed-content-from-origin.sh"if [[ ! -x "$worker" ]]; then echo "Deploy checkout has no executable content worker: $worker" exit 2fi
export CAMERON_SITE_REPO="$WORKER_REPO"export CAMERON_SITE_SYNC_STATE_DIR="$STATE_DIR"cd "$WORKER_REPO"exec "$worker"