Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/openclaw-rs/blob/main/install.sh # openclaw-rs High-performance sovereign agent runtime in native Rust and Mojo for NVIDIA DGX Spark Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `openclaw-rs / install.sh` 153 lines ยท 4162 bytes Raw Blame History 1 #!/bin/sh 2 set -eu 3 4 # OpenClaw native binary installer 5 # Pure compiled Rust runtime for sovereign AI agents. 6 7 REPO="aien-dev/openclaw-rs" 8 BIN_NAME="openclaw" 9 INSTALL_DIR="${OPENCLAW_INSTALL_DIR:-$HOME/.local/bin}" 10 STAGED_DIR="${OPENCLAW_STAGED_DIR:-}" 11 12 # Parse optional command-line arguments 13 while [ $# -gt 0 ]; do 14 case "$1" in 15 --staged) 16 STAGED_DIR="$2" 17 shift 2 18 ;; 19 --install-dir) 20 INSTALL_DIR="$2" 21 shift 2 22 ;; 23 --help|-h) 24 echo "Usage: install.sh [--staged ] [--install-dir ]" 25 exit 0 26 ;; 27 *) 28 echo "Unknown option: $1" >&2 29 exit 1 30 ;; 31 esac 32 done 33 34 OS="$(uname -s)" 35 if [ "$OS" != "Linux" ]; then 36 echo "Error: Operating system $OS is not supported. Linux is required." >&2 37 exit 1 38 fi 39 40 RAW_ARCH="$(uname -m)" 41 case "$RAW_ARCH" in 42 aarch64|arm64) 43 ARCH="aarch64" 44 ;; 45 x86_64|amd64) 46 ARCH="x86_64" 47 ;; 48 *) 49 echo "Error: Architecture $RAW_ARCH is not supported." >&2 50 exit 1 51 ;; 52 esac 53 54 echo "[+] Platform: Linux ($ARCH)" 55 56 TARBALL="openclaw-linux-${ARCH}.tar.gz" 57 CHECKSUM_FILE="${TARBALL}.sha256" 58 59 TMP_DIR="$(mktemp -d)" 60 cleanup() { 61 rm -rf "$TMP_DIR" 62 } 63 trap cleanup EXIT INT TERM 64 65 if [ -n "$STAGED_DIR" ]; then 66 echo "[+] Installing from local staged directory: $STAGED_DIR" 67 if [ -f "$STAGED_DIR/$TARBALL" ]; then 68 cp "$STAGED_DIR/$TARBALL" "$TMP_DIR/$TARBALL" 69 if [ -f "$STAGED_DIR/$CHECKSUM_FILE" ]; then 70 cp "$STAGED_DIR/$CHECKSUM_FILE" "$TMP_DIR/$CHECKSUM_FILE" 71 fi 72 else 73 MATCHING="$(find "$STAGED_DIR" -maxdepth 1 -name "openclaw-*-linux-${ARCH}.tar.gz" 2>/dev/null | head -n 1)" 74 if [ -n "$MATCHING" ] && [ -f "$MATCHING" ]; then 75 cp "$MATCHING" "$TMP_DIR/$TARBALL" 76 if [ -f "${MATCHING}.sha256" ]; then 77 cp "${MATCHING}.sha256" "$TMP_DIR/$CHECKSUM_FILE" 78 fi 79 else 80 echo "Error: Could not locate $TARBALL in staged directory $STAGED_DIR" >&2 81 exit 1 82 fi 83 fi 84 else 85 BASE_URL="https://github.com/${REPO}/releases/latest/download" 86 DOWNLOAD_URL="${BASE_URL}/${TARBALL}" 87 CHECKSUM_URL="${BASE_URL}/${CHECKSUM_FILE}" 88 89 echo "[+] Downloading $DOWNLOAD_URL..." 90 if command -v curl >/dev/null 2>&1; then 91 curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL" 92 curl -fsSL "$CHECKSUM_URL" -o "$TMP_DIR/$CHECKSUM_FILE" 2>/dev/null || true 93 elif command -v wget >/dev/null 2>&1; then 94 wget -qO "$TMP_DIR/$TARBALL" "$DOWNLOAD_URL" 95 wget -qO "$TMP_DIR/$CHECKSUM_FILE" "$CHECKSUM_URL" 2>/dev/null || true 96 else 97 echo "Error: Neither curl nor wget was found on PATH." >&2 98 exit 1 99 fi 100 fi 101 102 if [ -f "$TMP_DIR/$CHECKSUM_FILE" ]; then 103 echo "[+] Verifying SHA256 checksum..." 104 EXPECTED_HASH="$(awk '{print $1}' "$TMP_DIR/$CHECKSUM_FILE")" 105 if command -v sha256sum >/dev/null 2>&1; then 106 ACTUAL_HASH="$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')" 107 elif command -v shasum >/dev/null 2>&1; then 108 ACTUAL_HASH="$(shasum -a 256 "$TMP_DIR/$TARBALL" | awk '{print $1}')" 109 else 110 echo "Warning: Neither sha256sum nor shasum found; skipping checksum verification." >&2 111 ACTUAL_HASH="$EXPECTED_HASH" 112 fi 113 114 if [ "$EXPECTED_HASH" != "$ACTUAL_HASH" ]; then 115 echo "Error: Checksum verification failed!" >&2 116 echo "Expected: $EXPECTED_HASH" >&2 117 echo "Actual: $ACTUAL_HASH" >&2 118 exit 1 119 fi 120 echo "[+] Checksum verified: $ACTUAL_HASH" 121 else 122 echo "[*] No checksum file provided; proceeding with extraction." 123 fi 124 125 echo "[+] Extracting $TARBALL..." 126 tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR" 127 128 if [ ! -f "$TMP_DIR/$BIN_NAME" ]; then 129 echo "Error: Binary $BIN_NAME not found in tarball archive." >&2 130 exit 1 131 fi 132 133 mkdir -p "$INSTALL_DIR" 134 cp "$TMP_DIR/$BIN_NAME" "$INSTALL_DIR/$BIN_NAME" 135 chmod +x "$INSTALL_DIR/$BIN_NAME" 136 137 echo "[+] Installed $BIN_NAME to $INSTALL_DIR/$BIN_NAME" 138 139 case ":$PATH:" in 140 *":$INSTALL_DIR:"*) 141 ;; 142 *) 143 echo "" 144 echo "Note: $INSTALL_DIR is not in your PATH." 145 echo "To enable direct execution, add the following to your ~/.bashrc or ~/.profile:" 146 echo " export PATH=\"$INSTALL_DIR:\$PATH\"" 147 echo "" 148 ;; 149 esac 150 151 echo "[+] Verification:" 152 "$INSTALL_DIR/$BIN_NAME" --help | head -n 2 153 echo "[+] Installation complete."