ScuttleBot

scuttlebot / deploy / standalone / install.sh
Source Blame History 55 lines
61c045e… lmata 1 #!/usr/bin/env bash
61c045e… lmata 2 # install.sh — scuttlebot standalone installer
61c045e… lmata 3 # Usage: curl -fsSL https://scuttlebot.dev/install.sh | bash
61c045e… lmata 4 # or: bash install.sh [--version v0.1.0] [--dir /usr/local/bin]
61c045e… lmata 5 set -euo pipefail
61c045e… lmata 6
61c045e… lmata 7 REPO="ConflictHQ/scuttlebot"
61c045e… lmata 8 INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
61c045e… lmata 9 VERSION="${VERSION:-}"
61c045e… lmata 10
61c045e… lmata 11 # Parse flags.
61c045e… lmata 12 while [[ $# -gt 0 ]]; do
61c045e… lmata 13 case "$1" in
61c045e… lmata 14 --version) VERSION="$2"; shift 2 ;;
61c045e… lmata 15 --dir) INSTALL_DIR="$2"; shift 2 ;;
61c045e… lmata 16 *) echo "Unknown option: $1" >&2; exit 1 ;;
61c045e… lmata 17 esac
61c045e… lmata 18 done
61c045e… lmata 19
61c045e… lmata 20 OS=$(uname -s | tr '[:upper:]' '[:lower:]')
61c045e… lmata 21 ARCH=$(uname -m)
61c045e… lmata 22 case "$ARCH" in
61c045e… lmata 23 x86_64) ARCH="x86_64" ;;
61c045e… lmata 24 aarch64|arm64) ARCH="arm64" ;;
61c045e… lmata 25 *) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
61c045e… lmata 26 esac
61c045e… lmata 27
61c045e… lmata 28 # Fetch latest version if not specified.
61c045e… lmata 29 if [[ -z "$VERSION" ]]; then
61c045e… lmata 30 VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
61c045e… lmata 31 | grep '"tag_name"' | sed 's/.*"tag_name": "\(.*\)".*/\1/')
61c045e… lmata 32 fi
61c045e… lmata 33
61c045e… lmata 34 ASSET="scuttlebot-${VERSION}-${OS}-${ARCH}.tar.gz"
61c045e… lmata 35 URL="https://github.com/${REPO}/releases/download/${VERSION}/${ASSET}"
61c045e… lmata 36
61c045e… lmata 37 echo "Installing scuttlebot ${VERSION} for ${OS}/${ARCH}..."
61c045e… lmata 38 echo "Downloading ${URL}"
61c045e… lmata 39
61c045e… lmata 40 TMP=$(mktemp -d)
61c045e… lmata 41 trap 'rm -rf "$TMP"' EXIT
61c045e… lmata 42
61c045e… lmata 43 curl -fsSL "$URL" -o "${TMP}/${ASSET}"
61c045e… lmata 44 tar -xzf "${TMP}/${ASSET}" -C "$TMP"
61c045e… lmata 45
61c045e… lmata 46 install -m 755 "${TMP}/scuttlebot" "${INSTALL_DIR}/scuttlebot"
61c045e… lmata 47
61c045e… lmata 48 echo ""
61c045e… lmata 49 echo "scuttlebot ${VERSION} installed to ${INSTALL_DIR}/scuttlebot"
61c045e… lmata 50 echo ""
61c045e… lmata 51 echo "Quick start:"
61c045e… lmata 52 echo " scuttlebot # boots ergo + daemon, auto-downloads ergo on first run"
61c045e… lmata 53 echo " scuttlebot --config /path/to/scuttlebot.yaml"
61c045e… lmata 54 echo ""
61c045e… lmata 55 echo "See: https://scuttlebot.dev/docs/deployment/standalone"

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button