#!/usr/bin/env bash # ASUS AI Agent — first-stage installer for ASUS Tinker Edge (64-bit ARM) boards. # # curl -fsSL https://raw.githubusercontent.com/Graphene-Lab/ASUS-AI-Agent/main/install.sh | bash # # Downloads the latest AgentBridge linux-arm64 release from GitHub, unpacks it into # /opt/agentbridge and installs it as a systemd service that auto-starts at boot. # The archive is self-contained (~700 MB): no .NET runtime needed, Kokoro TTS voices # and the speech model are included. Missing dependencies are installed automatically. # # Environment overrides: # ASUS_AGENT_VERSION release tag to install, e.g. v1.26.08.30 (default: latest) # ASUS_AGENT_HOME install directory (default: /opt/agentbridge) # ASUS_AGENT_NO_SERVICE=1 unpack only, no systemd service set -euo pipefail AGENT_REPO="Graphene-Lab/AgentBridge" VERSION="${ASUS_AGENT_VERSION:-latest}" DEST="${ASUS_AGENT_HOME:-/opt/agentbridge}" NO_SERVICE="${ASUS_AGENT_NO_SERVICE:-0}" # --- platform check (ASUS = 64-bit ARM Linux) --- [ "$(uname -s)" = "Linux" ] || { echo "This installer targets Linux (ASUS)." >&2; exit 1; } [ "$(uname -m)" = "aarch64" ] || { echo "This installer targets 64-bit ARM (aarch64) boards, not $(uname -m)." >&2; exit 1; } # --- dependencies (curl, tar) --- missing="" command -v curl >/dev/null 2>&1 || missing="$missing curl" command -v tar >/dev/null 2>&1 || missing="$missing tar" if [ -n "$missing" ]; then echo "Installing missing dependencies:$missing" if command -v apt-get >/dev/null 2>&1; then sudo apt-get update -qq && sudo apt-get install -y -qq curl tar else echo "Please install curl and tar, then re-run." >&2 exit 1 fi fi # --- libicu for .NET globalization (best-effort, non-fatal) --- if command -v dpkg >/dev/null 2>&1; then if ! /sbin/ldconfig -p 2>/dev/null | grep -q 'libicuuc\.so'; then echo "Installing libicu (.NET globalization)..." sudo apt-get update -qq && sudo apt-get install -y -qq libicu-dev || \ echo "WARN: libicu install failed (the app may need it on this distro)." >&2 fi fi # --- download the latest (or pinned) AgentBridge linux-arm64 release --- if [ "$VERSION" = "latest" ]; then BASE="https://github.com/$AGENT_REPO/releases/latest/download" else BASE="https://github.com/$AGENT_REPO/releases/download/$VERSION" fi ASSET="agentbridge-linux-arm64.tar.gz" echo "Downloading $BASE/$ASSET ..." sudo mkdir -p "$DEST" tmp="$(mktemp -d)" trap 'rm -rf "$tmp"' EXIT curl -fL --retry 3 -o "$tmp/$ASSET" "$BASE/$ASSET" # --- unpack directly into the destination (the tmp dir may be a small tmpfs) --- echo "Unpacking into $DEST ..." sudo tar -xzf "$tmp/$ASSET" -C "$DEST" rm -f "$tmp/$ASSET" # The archive files carry the CI build uid; force a sane owner so the app can write # its runtime state (logs/) without permission errors. sudo chown -R root:root "$DEST" sudo chmod +x "$DEST/agent" # --- systemd service (auto-start at boot, always-on) --- if [ "$NO_SERVICE" = "0" ] && [ -d /run/systemd/system ]; then echo "Installing systemd service (auto-start at boot)..." sudo tee /etc/systemd/system/agentbridge.service >/dev/null <&2 journalctl -u agentbridge -n 10 --no-pager >&2 || true fi fi echo echo "ASUS AI Agent installed to $DEST." echo "HTTP API: http://localhost:5290 (health: /health, models: /v1/models)" if [ "$NO_SERVICE" = "1" ]; then echo "Start the assistant with: $DEST/agent" else echo "The assistant is always on; for the terminal chat run:" echo " sudo systemctl stop agentbridge && $DEST/agent" echo "then restart it with: sudo systemctl start agentbridge" fi echo "Next: type /modelsetup in the chat to choose your AI provider."