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/aegis-runtime-mv/blob/main/install.sh # aegis-runtime-mv Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha. 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 `aegis-runtime-mv / install.sh` 156 lines ยท 4234 bytes Raw Blame History 1 #!/bin/sh 2 set -eu 3 4 # AEGIS native binary installer 5 # Pure compiled Rust runtime for sovereign AI agents. 6 7 REPO="aien-dev/aegis-runtime" 8 BIN_NAME="aegis" 9 INSTALL_DIR="${AEGIS_INSTALL_DIR:-$HOME/.local/bin}" 10 STAGED_DIR="${AEGIS_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="aegis-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 "aegis-*-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" 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" 96 else 97 echo "Error: Neither curl nor wget was found on PATH." >&2 98 exit 1 99 fi 100 fi 101 102 # Every install path verifies the tarball. A missing or empty checksum, a 103 # missing hash tool or a mismatch stops the install. 104 if [ ! -s "$TMP_DIR/$CHECKSUM_FILE" ]; then 105 echo "Error: No checksum file for $TARBALL; refusing to install an unverified binary." >&2 106 exit 1 107 fi 108 109 echo "[+] Verifying SHA256 checksum..." 110 EXPECTED_HASH="$(awk 'NR == 1 {print $1}' "$TMP_DIR/$CHECKSUM_FILE")" 111 if command -v sha256sum >/dev/null 2>&1; then 112 ACTUAL_HASH="$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')" 113 elif command -v shasum >/dev/null 2>&1; then 114 ACTUAL_HASH="$(shasum -a 256 "$TMP_DIR/$TARBALL" | awk '{print $1}')" 115 else 116 echo "Error: Neither sha256sum nor shasum found; cannot verify $TARBALL." >&2 117 exit 1 118 fi 119 120 if [ -z "$EXPECTED_HASH" ] || [ "$EXPECTED_HASH" != "$ACTUAL_HASH" ]; then 121 echo "Error: Checksum verification failed!" >&2 122 echo "Expected: $EXPECTED_HASH" >&2 123 echo "Actual: $ACTUAL_HASH" >&2 124 exit 1 125 fi 126 echo "[+] Checksum verified: $ACTUAL_HASH" 127 128 echo "[+] Extracting $TARBALL..." 129 tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR" 130 131 if [ ! -f "$TMP_DIR/$BIN_NAME" ]; then 132 echo "Error: Binary $BIN_NAME not found in tarball archive." >&2 133 exit 1 134 fi 135 136 mkdir -p "$INSTALL_DIR" 137 cp "$TMP_DIR/$BIN_NAME" "$INSTALL_DIR/$BIN_NAME" 138 chmod +x "$INSTALL_DIR/$BIN_NAME" 139 140 echo "[+] Installed $BIN_NAME to $INSTALL_DIR/$BIN_NAME" 141 142 case ":$PATH:" in 143 *":$INSTALL_DIR:"*) 144 ;; 145 *) 146 echo "" 147 echo "Note: $INSTALL_DIR is not in your PATH." 148 echo "To enable direct execution, add the following to your ~/.bashrc or ~/.profile:" 149 echo " export PATH=\"$INSTALL_DIR:\$PATH\"" 150 echo "" 151 ;; 152 esac 153 154 echo "[+] Verification:" 155 "$INSTALL_DIR/$BIN_NAME" --help | head -n 2 156 echo "[+] Installation complete."