#!/usr/bin/env bash # Role guard for split deployments. # # run-if-role.sh # # Runs only when JARVIS_ROLE is one of (or "full"/unset). # Otherwise it idles so supervisord keeps the program slot "running" without # doing any work. This lets ONE image serve three layouts: # # JARVIS_ROLE=full (default) everything in one container # JARVIS_ROLE=browser only the desktop + Chrome + CDP (reused over the LAN) # JARVIS_ROLE=bot only the bot + bridge + TTS (drives a remote browser # via CDP_HOST/CDP_PORT) set -e want="$1"; shift role="${JARVIS_ROLE:-full}" if [ "$role" = "full" ]; then exec "$@"; fi case ",$want," in *",$role,"*) exec "$@" ;; esac echo "[role-guard] JARVIS_ROLE=$role not in '$want' — idling: $*" >&2 exec sleep infinity