#!/usr/bin/env bash # clawmates-node installer. Downloads the daemon binary and runs it against your # ClawMates gateway with the pairing token from the "Connect a host" wizard. # # curl -fsSL /install.sh | bash -s -- --server --token # # Until binary hosting is wired up you can also build from source: # cargo build --release -p clawmates-node # ./target/release/clawmates-node --server --token set -euo pipefail SERVER="" TOKEN="" while [[ $# -gt 0 ]]; do case "$1" in --server) SERVER="$2"; shift 2 ;; --token) TOKEN="$2"; shift 2 ;; *) shift ;; esac done if [[ -z "$SERVER" || -z "$TOKEN" ]]; then echo "usage: install.sh --server --token " >&2 exit 2 fi BIN_DIR="${CLAWMATES_BIN_DIR:-$HOME/.clawmates/bin}" BIN="$BIN_DIR/clawmates-node" mkdir -p "$BIN_DIR" # Download the prebuilt binary if a release URL is configured; otherwise the user # builds from source (see header) and points CLAWMATES_NODE_BIN at it. if [[ -n "${CLAWMATES_NODE_BIN:-}" ]]; then cp "$CLAWMATES_NODE_BIN" "$BIN" elif [[ ! -x "$BIN" ]]; then OS="$(uname -s | tr '[:upper:]' '[:lower:]')" ARCH="$(uname -m)" URL="${CLAWMATES_NODE_URL:-$SERVER/dl/clawmates-node-$OS-$ARCH}" echo "downloading clawmates-node from $URL" curl -fsSL "$URL" -o "$BIN" || { echo "download failed — build from source: cargo build --release -p clawmates-node" >&2 exit 1 } fi chmod +x "$BIN" echo "starting clawmates-node → $SERVER" exec "$BIN" --server "$SERVER" --token "$TOKEN"