library-rag-export.service now regenerates reading_umap.json on cyrion whenever the corpus or its located highlights move, writing straight into this checkout. Keeping it tracked would defeat that: a generated file that changes under git dirties the tree, which both flips auto-build.sh's change signature and breaks the `git pull` at the top of every build tick — the reason notebooks-export/ is already ignored, in that file's own words. So it joins them: ignored, plus a find line in the signature block so the 5-minute tick still notices a new projection. The cost is that a fresh checkout has no map until the service runs — on cyrion that is within the hour, anywhere else never. ReadingMap.astro says so where someone would hit it.
45 lines
1.7 KiB
Bash
Executable File
45 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Timer target: rebuild the garden only when the vault or repo changed.
|
|
# Successor to the Quartz update_quartz_docker.sh change-detection loop.
|
|
# Usage: auto-build.sh [--force] (--force skips change detection — used
|
|
# by the manual rebuild hook)
|
|
set -eu
|
|
|
|
REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
VAULT="${VAULT:-/home/nox/docker/obsidian/vaults/weeslahw_coppermind}"
|
|
STATE="$REPO/.build_state"
|
|
FORCE=0
|
|
[ "${1:-}" = "--force" ] && FORCE=1
|
|
|
|
cd "$REPO"
|
|
|
|
# serialize builds: the 5-min timer and the manual hook must never run
|
|
# docker/npm into the same checkout concurrently
|
|
exec 9>"$REPO/.build.lock"
|
|
flock 9
|
|
|
|
# a dirty tree can make pull fail; still rebuild whatever is checked out
|
|
git pull -q || echo "git pull failed (dirty tree?) — building local state"
|
|
|
|
# signature covers committed HEAD, any uncommitted repo edits, vault mtimes,
|
|
# and the notebook exports (gitignored, so git status/diff can't see them —
|
|
# they land here on their own timer via deploy/export-notebooks.py)
|
|
sig=$({
|
|
git rev-parse HEAD
|
|
git status --porcelain=v1
|
|
git diff
|
|
find "$VAULT" -name .obsidian -prune -o -type f -printf '%T@ %p\n' | sort
|
|
find "$REPO/notebooks-export" -type f -printf '%T@ %p\n' 2>/dev/null | sort
|
|
# same deal for the reading map: gitignored, written by library-rag-export.service on its
|
|
# own timer, so git status/diff above cannot see it change
|
|
find "$REPO/public/reading_umap.json" -printf '%T@ %p\n' 2>/dev/null | sort
|
|
} | sha256sum | cut -d' ' -f1)
|
|
|
|
if [ "$FORCE" -eq 0 ] && [ -f "$STATE" ] && [ "$(cat "$STATE")" = "$sig" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
sh "$REPO/deploy/build.sh"
|
|
printf %s "$sig" >"$STATE"
|
|
echo "garden rebuilt $(date -Is)"
|