Steps 4-6: the jobs, the set-up tab with generated scripts, Install the staged folder, site bundles and the campus template
- Overview jobs: Change the playlist, Add or remove a HyperDeck, Add a MIDI link, Add a computer, Make a PC program startable; 'Add a key for it' on unwatched Companion connections. - Computers > Setup: steps with a [how] each and the set-up scripts generated per computer by settings/scripts.py from the templates in remote-access/ (no site-shaped value left in them); Remove this computer drops the fixes and checks that used it. - Site setup > Site: the running and staged code, Install the staged folder (a one-shot launchd job running install.sh --keep-config, refused while live), Export site bundle (zip), New campus from a bundle (this campus's site block stays; every copied computer is flagged until touched). - sites/: na -> the repo config, _template = the empty campus; install.sh --site <id>. - Review reads appended checks as 'added'; tests for all of it. - Deployed page-only to NA Ingest. (config.json, status_panel.py and readiness.py are left to the READY-page work in progress in the same tree.) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+18
-3
@@ -4,6 +4,7 @@
|
||||
#
|
||||
# zsh install.sh install / update and (re)start
|
||||
# zsh install.sh --keep-config update the code but leave the live config.json as it is
|
||||
# zsh install.sh --site <id> first install of a campus: its config from sites/<id>/, else sites/_template/
|
||||
# zsh install.sh --rollback put the previous code back (kept in prev/) and restart
|
||||
# zsh install.sh --remove stop it and remove the LaunchAgent (files stay)
|
||||
#
|
||||
@@ -19,13 +20,25 @@ PLIST="$HOME/Library/LaunchAgents/$LABEL.plist"
|
||||
DOMAIN="gui/$(id -u)"
|
||||
CODE=(status_panel.py coremidi.py netgear.py schema.py make_page.py push_page.py nav_keys.py atem_watch.js atem_state.js nav_templates.json)
|
||||
KEEP_CONFIG=0
|
||||
SITE=""
|
||||
SITE_NEXT=0
|
||||
for arg in "$@"; do
|
||||
if [[ $SITE_NEXT == 1 ]]; then SITE="$arg"; SITE_NEXT=0; continue; fi
|
||||
case "$arg" in
|
||||
--keep-config) KEEP_CONFIG=1 ;;
|
||||
--site) SITE_NEXT=1 ;;
|
||||
--remove|--rollback|--now) ;;
|
||||
*) echo "unknown option $arg" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
# The config to install: the campus folder when asked for, else this folder's config.json.
|
||||
SRC_CONFIG="$SRC/config.json"
|
||||
if [[ -n "$SITE" ]]; then
|
||||
if [[ -f "$SRC/sites/$SITE/config.json" ]]; then SRC_CONFIG="$SRC/sites/$SITE/config.json"
|
||||
elif [[ -f "$SRC/sites/_template/config.json" ]]; then SRC_CONFIG="$SRC/sites/_template/config.json"; echo "no sites/$SITE/ in the folder: starting from the template"
|
||||
else echo "no sites/ folder here" >&2; exit 2; fi
|
||||
[[ -f "$DEST/config.json" ]] && KEEP_CONFIG=1 && echo "a config is already installed: left alone (the page's 'New campus from a bundle' replaces it)"
|
||||
fi
|
||||
|
||||
restart_agent() { # $1 = label, $2 = plist
|
||||
local label=${1:-$LABEL} plist=${2:-$PLIST}
|
||||
@@ -143,7 +156,7 @@ mkdir -p "$DEST"
|
||||
if [[ $KEEP_CONFIG == 1 && -f "$DEST/config.json" ]]; then
|
||||
CFG="$DEST/config.json"
|
||||
else
|
||||
CFG="$SRC/config.json"
|
||||
CFG="$SRC_CONFIG"
|
||||
fi
|
||||
/usr/bin/python3 "$SRC/status_panel.py" --check --config "$CFG"
|
||||
EXIT_TIMEOUT=$(/usr/bin/python3 "$SRC/status_panel.py" --exit-timeout --config "$CFG")
|
||||
@@ -154,14 +167,16 @@ for f in $CODE; do [[ -f "$DEST/$f" ]] && cp "$DEST/$f" "$DEST/prev/"; done
|
||||
|
||||
# 3. Files. The live config is backed up when it changes; --keep-config leaves it alone.
|
||||
if [[ $KEEP_CONFIG == 0 ]]; then
|
||||
if [[ -f "$DEST/config.json" ]] && ! cmp -s "$SRC/config.json" "$DEST/config.json"; then
|
||||
if [[ -f "$DEST/config.json" ]] && ! cmp -s "$SRC_CONFIG" "$DEST/config.json"; then
|
||||
cp "$DEST/config.json" "$DEST/config.json.bak-$(date +%Y%m%d-%H%M%S)"
|
||||
echo "config.json replaced (the old one is kept as config.json.bak-...; use --keep-config to leave it)"
|
||||
fi
|
||||
cp "$SRC/config.json" "$DEST/"
|
||||
cp "$SRC_CONFIG" "$DEST/config.json"
|
||||
fi
|
||||
for f in $CODE; do [[ -f "$SRC/$f" ]] && cp "$SRC/$f" "$DEST/"; done
|
||||
[[ -f "$SRC/atem-reference.xml" ]] && cp "$SRC/atem-reference.xml" "$DEST/"
|
||||
# The set-up script templates the page fills in for each computer.
|
||||
[[ -d "$SRC/remote-access" ]] && rm -rf "$DEST/remote-access" && cp -R "$SRC/remote-access" "$DEST/"
|
||||
# The settings page (its own LaunchAgent) and the record of coloured page-number keys (site-owned: never overwritten).
|
||||
if [[ -d "$SRC/settings" ]]; then
|
||||
rm -rf "$DEST/settings" && cp -R "$SRC/settings" "$DEST/" && find "$DEST/settings" -name "__pycache__" -prune -exec rm -rf {} + 2>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user