#!/usr/bin/env bash # arca-synth install bootstrap (served by https://synth.arca.vision/). # # Reads ARCA_API_KEY from env, prompts /dev/tty if interactive, then # fetches the signed installer from /v2/install and runs it. Power # users / CI can skip this layer by passing the header on their own # curl: # # curl -fsSL -H "X-Arca-Token: $KEY" https://synth.arca.vision | sudo bash # # Or by setting the env var before piping: # # sudo ARCA_API_KEY=ak_xxx bash <(curl -fsSL https://synth.arca.vision) # # Empty / missing token is supported too — the daemon runs in offline # fallback mode, gated to GGUFs already staged on disk. The bootstrap # treats an empty answer at the prompt as explicit opt-in to offline. set -eo pipefail R=$'\033[0;31m'; B=$'\033[0;34m'; N=$'\033[0m' say() { printf "%s==>%s %s\n" "$B" "$N" "$*"; } die() { printf "%sX%s %s\n" "$R" "$N" "$*" >&2; exit 1; } [ "$(id -u)" -eq 0 ] || die "arca-synth install: must be run as root (try: sudo bash)" have_tty() { { : /dev/null; } # set -u not used: $ARCA_API_KEY may be unset and we treat that as # empty. Empty answer → offline install path. if [ -z "$ARCA_API_KEY" ] && have_tty; then printf "%s==>%s API key (paste or press Enter for offline mode): " "$B" "$N" >&2 read -rs ARCA_API_KEY < /dev/tty echo >&2 fi INSTALLER=$(mktemp) trap 'rm -f "$INSTALLER"' EXIT if [ -z "$ARCA_API_KEY" ]; then say "No API key supplied — fetching offline installer" HTTP=$(curl -sSL \ -o "$INSTALLER" \ -w '%{http_code}' \ https://synth.arca.vision/v2/install-offline) || HTTP="000" else say "Authorising with synth.arca.vision and fetching signed installer" HTTP=$(curl -sSL \ -H "X-Arca-Token: $ARCA_API_KEY" \ -o "$INSTALLER" \ -w '%{http_code}' \ https://synth.arca.vision/v2/install) || HTTP="000" fi case "$HTTP" in 200) ;; 000) die "could not reach synth.arca.vision (network or DNS)" ;; 401) cat "$INSTALLER" >&2; die "synth.arca.vision rejected the API key (401)" ;; 402) cat "$INSTALLER" >&2; die "this license is not entitled to arca-synth (402)" ;; 403) cat "$INSTALLER" >&2; die "synth.arca.vision returned 403" ;; *) cat "$INSTALLER" >&2; die "synth.arca.vision returned HTTP $HTTP" ;; esac bash "$INSTALLER"