aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / install-inquisitor.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | set -eu |
| 18 | |
| 19 | # Spark-Inquisitor native binary installer |
| 20 | # Sovereign gatekeeper, diff auditor, and constitutional alignment engine. |
| 21 | |
| 22 | REPO="aien-dev/aien-sovereign-core" |
| 23 | BIN_NAME="spark-inquisitor" |
| 24 | INSTALL_DIR="${INQUISITOR_INSTALL_DIR:-$HOME/.local/bin}" |
| 25 | STAGED_DIR="${INQUISITOR_STAGED_DIR:-}" |
| 26 | VERSION="${INQUISITOR_VERSION:-v0.2.0}" |
| 27 | |
| 28 | # Parse optional command-line arguments |
| 29 | while [ $# -gt 0 ]; do |
| 30 | case "$1" in |
| 31 | --staged) |
| 32 | STAGED_DIR="$2" |
| 33 | shift 2 |
| 34 | ;; |
| 35 | --install-dir) |
| 36 | INSTALL_DIR="$2" |
| 37 | shift 2 |
| 38 | ;; |
| 39 | --version) |
| 40 | VERSION="$2" |
| 41 | shift 2 |
| 42 | ;; |
| 43 | --help|-h) |
| 44 | echo "Usage: install-inquisitor.sh [--staged <dir>] [--install-dir <dir>] [--version <tag>]" |
| 45 | exit 0 |
| 46 | ;; |
| 47 | *) |
| 48 | echo "Unknown option: $1" >&2 |
| 49 | exit 1 |
| 50 | ;; |
| 51 | esac |
| 52 | done |
| 53 | |
| 54 | OS="$(uname -s)" |
| 55 | if [ "$OS" != "Linux" ]; then |
| 56 | echo "Error: Operating system $OS is not supported. Linux is required." >&2 |
| 57 | exit 1 |
| 58 | fi |
| 59 | |
| 60 | RAW_ARCH="$(uname -m)" |
| 61 | case "$RAW_ARCH" in |
| 62 | aarch64|arm64) |
| 63 | ARCH="aarch64" |
| 64 | ;; |
| 65 | x86_64|amd64) |
| 66 | ARCH="x86_64" |
| 67 | ;; |
| 68 | *) |
| 69 | echo "Error: Architecture $RAW_ARCH is not supported." >&2 |
| 70 | exit 1 |
| 71 | ;; |
| 72 | esac |
| 73 | |
| 74 | echo "[+] Platform: Linux ($ARCH)" |
| 75 | |
| 76 | TARBALL="spark-inquisitor-${VERSION}-linux-${ARCH}.tar.gz" |
| 77 | CHECKSUM_FILE="${TARBALL}.sha256" |
| 78 | |
| 79 | TMP_DIR="$(mktemp -d)" |
| 80 | cleanup() { |
| 81 | rm -rf "$TMP_DIR" |
| 82 | } |
| 83 | trap cleanup EXIT INT TERM |
| 84 | |
| 85 | if [ -n "$STAGED_DIR" ]; then |
| 86 | echo "[+] Installing from local staged directory: $STAGED_DIR" |
| 87 | if [ -f "$STAGED_DIR/$TARBALL" ]; then |
| 88 | cp "$STAGED_DIR/$TARBALL" "$TMP_DIR/$TARBALL" |
| 89 | if [ -f "$STAGED_DIR/$CHECKSUM_FILE" ]; then |
| 90 | cp "$STAGED_DIR/$CHECKSUM_FILE" "$TMP_DIR/$CHECKSUM_FILE" |
| 91 | fi |
| 92 | else |
| 93 | MATCHING="$(find "$STAGED_DIR" -maxdepth 1 -name "spark-inquisitor-*-linux-${ARCH}.tar.gz" 2>/dev/null | head -n 1)" |
| 94 | if [ -n "$MATCHING" ] && [ -f "$MATCHING" ]; then |
| 95 | cp "$MATCHING" "$TMP_DIR/$TARBALL" |
| 96 | if [ -f "${MATCHING}.sha256" ]; then |
| 97 | cp "${MATCHING}.sha256" "$TMP_DIR/$CHECKSUM_FILE" |
| 98 | fi |
| 99 | else |
| 100 | echo "Error: Could not locate $TARBALL in staged directory $STAGED_DIR" >&2 |
| 101 | exit 1 |
| 102 | fi |
| 103 | fi |
| 104 | else |
| 105 | BASE_URL="https://github.com/${REPO}/releases/download/${VERSION}" |
| 106 | DOWNLOAD_URL="${BASE_URL}/${TARBALL}" |
| 107 | CHECKSUM_URL="${BASE_URL}/${CHECKSUM_FILE}" |
| 108 | |
| 109 | echo "[+] Downloading $DOWNLOAD_URL..." |
| 110 | if command -v curl >/dev/null 2>&1; then |
| 111 | curl -fsSL "$DOWNLOAD_URL" -o "$TMP_DIR/$TARBALL" |
| 112 | curl -fsSL "$CHECKSUM_URL" -o "$TMP_DIR/$CHECKSUM_FILE" 2>/dev/null || true |
| 113 | elif command -v wget >/dev/null 2>&1; then |
| 114 | wget -qO "$TMP_DIR/$TARBALL" "$DOWNLOAD_URL" |
| 115 | wget -qO "$TMP_DIR/$CHECKSUM_FILE" "$CHECKSUM_URL" 2>/dev/null || true |
| 116 | else |
| 117 | echo "Error: Neither curl nor wget was found on PATH." >&2 |
| 118 | exit 1 |
| 119 | fi |
| 120 | fi |
| 121 | |
| 122 | if [ -f "$TMP_DIR/$CHECKSUM_FILE" ]; then |
| 123 | echo "[+] Verifying SHA256 checksum..." |
| 124 | EXPECTED_HASH="$(awk '{print $1}' "$TMP_DIR/$CHECKSUM_FILE")" |
| 125 | if command -v sha256sum >/dev/null 2>&1; then |
| 126 | ACTUAL_HASH="$(sha256sum "$TMP_DIR/$TARBALL" | awk '{print $1}')" |
| 127 | elif command -v shasum >/dev/null 2>&1; then |
| 128 | ACTUAL_HASH="$(shasum -a 256 "$TMP_DIR/$TARBALL" | awk '{print $1}')" |
| 129 | else |
| 130 | echo "Warning: Neither sha256sum nor shasum found; skipping checksum verification." >&2 |
| 131 | ACTUAL_HASH="$EXPECTED_HASH" |
| 132 | fi |
| 133 | |
| 134 | if [ "$EXPECTED_HASH" != "$ACTUAL_HASH" ]; then |
| 135 | echo "Error: Checksum verification failed!" >&2 |
| 136 | echo "Expected: $EXPECTED_HASH" >&2 |
| 137 | echo "Actual: $ACTUAL_HASH" >&2 |
| 138 | exit 1 |
| 139 | fi |
| 140 | echo "[+] Checksum verified: $ACTUAL_HASH" |
| 141 | else |
| 142 | echo "[*] No checksum file provided; proceeding with extraction." |
| 143 | fi |
| 144 | |
| 145 | echo "[+] Extracting $TARBALL..." |
| 146 | tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR" |
| 147 | |
| 148 | if [ ! -f "$TMP_DIR/$BIN_NAME" ]; then |
| 149 | echo "Error: Binary $BIN_NAME not found in tarball archive." >&2 |
| 150 | exit 1 |
| 151 | fi |
| 152 | |
| 153 | mkdir -p "$INSTALL_DIR" |
| 154 | cp "$TMP_DIR/$BIN_NAME" "$INSTALL_DIR/$BIN_NAME" |
| 155 | chmod +x "$INSTALL_DIR/$BIN_NAME" |
| 156 | |
| 157 | echo "[+] Installed $BIN_NAME to $INSTALL_DIR/$BIN_NAME" |
| 158 | |
| 159 | case ":$PATH:" in |
| 160 | *":$INSTALL_DIR:"*) |
| 161 | ;; |
| 162 | *) |
| 163 | echo "" |
| 164 | echo "Note: $INSTALL_DIR is not in your PATH." |
| 165 | echo "To enable direct execution, add the following to your ~/.bashrc or ~/.profile:" |
| 166 | echo " export PATH=\"$INSTALL_DIR:\$PATH\"" |
| 167 | echo "" |
| 168 | ;; |
| 169 | esac |
| 170 | |
| 171 | echo "[+] Verification:" |
| 172 | "$INSTALL_DIR/$BIN_NAME" --version |
| 173 | echo "[+] Installation complete." |