#!/usr/bin/env bash # Tools: spritegen, setup cmd_tools_spritegen() { python3 "$REPO_ROOT/tools/sprite-generation/cli.py" "$@" } cmd_setup() { case "$(uname -s)" in Darwin) "$REPO_ROOT/scripts/dev-setup/osx.sh" "$@" ;; Linux) "$REPO_ROOT/scripts/dev-setup/linux.sh" "$@" ;; *) echo -e "${RED}Unsupported OS: $(uname -s)${NC}"; exit 1 ;; esac } # ── setup: — per-distro / per-role package install ────────── # These run EITHER locally on the current host (when the user wants # to set up the machine they're on) OR get SSH-delegated when the # caller is on EDIT host and the target matches a remote role. cmd_setup_bluefin() { # Local path: we're running ON a bluefin/bootc host (apricot). if [ -f /etc/os-release ] && grep -qE 'bluefin|silverblue|ublue|ID="centos"' /etc/os-release 2>/dev/null \ && command -v rpm-ostree &>/dev/null; then "$REPO_ROOT/scripts/dev-setup/bluefin.sh" "$@" return $? fi # Remote path: we're on EDIT (Mac) — delegate via ssh $AUTOPLAY_HOST. local host="${AUTOPLAY_HOST:-${RUN_HOST:-${LINUX_HOST:-}}}" if [ -z "$host" ]; then echo -e "${RED}setup:bluefin: not running on a bluefin host, and no RUN-host env var set.${NC}" echo -e "${DIM}Set one of: AUTOPLAY_HOST, RUN_HOST, LINUX_HOST — or run this command on the bluefin host directly.${NC}" return 2 fi local remote_root="${PROJECT_ROOT_REMOTE:-\$HOME/Code/@projects/@magic-civilization}" echo -e "${BLUE}[delegate] setup:bluefin → $host${NC}" # Ship the setup script alone (fast; doesn't disturb running batches). rsync -az "$REPO_ROOT/scripts/dev-setup/bluefin.sh" \ "$host:$remote_root/scripts/dev-setup/bluefin.sh" 2>&1 | tail -3 # Recurse. Quote args individually to preserve --check etc. local quoted="" for a in "$@"; do quoted+=" $(printf '%q' "$a")"; done ssh "$host" "cd $remote_root && bash scripts/dev-setup/bluefin.sh$quoted" }