interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / install-inquisitor.sh

173 lines · 4995 bytes Raw Blame History
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
17set -eu
18
19# Spark-Inquisitor native binary installer
20# Sovereign gatekeeper, diff auditor, and constitutional alignment engine.
21
22REPO="aien-dev/aien-sovereign-core"
23BIN_NAME="spark-inquisitor"
24INSTALL_DIR="${INQUISITOR_INSTALL_DIR:-$HOME/.local/bin}"
25STAGED_DIR="${INQUISITOR_STAGED_DIR:-}"
26VERSION="${INQUISITOR_VERSION:-v0.2.0}"
27
28# Parse optional command-line arguments
29while [ $# -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
52done
53
54OS="$(uname -s)"
55if [ "$OS" != "Linux" ]; then
56 echo "Error: Operating system $OS is not supported. Linux is required." >&2
57 exit 1
58fi
59
60RAW_ARCH="$(uname -m)"
61case "$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 ;;
72esac
73
74echo "[+] Platform: Linux ($ARCH)"
75
76TARBALL="spark-inquisitor-${VERSION}-linux-${ARCH}.tar.gz"
77CHECKSUM_FILE="${TARBALL}.sha256"
78
79TMP_DIR="$(mktemp -d)"
80cleanup() {
81 rm -rf "$TMP_DIR"
82}
83trap cleanup EXIT INT TERM
84
85if [ -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
104else
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
120fi
121
122if [ -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"
141else
142 echo "[*] No checksum file provided; proceeding with extraction."
143fi
144
145echo "[+] Extracting $TARBALL..."
146tar -xzf "$TMP_DIR/$TARBALL" -C "$TMP_DIR"
147
148if [ ! -f "$TMP_DIR/$BIN_NAME" ]; then
149 echo "Error: Binary $BIN_NAME not found in tarball archive." >&2
150 exit 1
151fi
152
153mkdir -p "$INSTALL_DIR"
154cp "$TMP_DIR/$BIN_NAME" "$INSTALL_DIR/$BIN_NAME"
155chmod +x "$INSTALL_DIR/$BIN_NAME"
156
157echo "[+] Installed $BIN_NAME to $INSTALL_DIR/$BIN_NAME"
158
159case ":$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 ;;
169esac
170
171echo "[+] Verification:"
172"$INSTALL_DIR/$BIN_NAME" --version
173echo "[+] Installation complete."