magicciv/scripts/run/tools.sh
Natalie c88e136469 fix(@projects): 🐛 update deployment and guide workflows
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-10 03:38:03 -07:00

56 lines
2.4 KiB
Bash

#!/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:lan-dns — subscribe the current host to black.lan DNS ────
# Standalone entry point for the subscribe script, so existing machines
# can re-run the subscription without going through the full `./run setup`
# dev-environment install. Also invoked at the end of osx.sh / linux.sh.
cmd_setup_lan_dns() {
bash "$REPO_ROOT/scripts/lan/subscribe-black-dns.sh" "$@"
}
# ── setup:<target> — 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"
}