#!/usr/bin/env bash # BATH ANALYTICS — CAMBRIDGE PROOF KERNEL BOOTSTRAP set -euo pipefail LICENSE_KEY="${1:-}" if [ -z "$LICENSE_KEY" ]; then echo "Error: License key required. Usage: curl -sL bathanalytics.com/install | bash -s BATH_CORE_" exit 1 fi echo "==========================================================" echo " BATH ANALYTICS — CAMBRIDGE PROOF KERNEL INSTALLER " echo "==========================================================" echo "Verifying license token..." OS="$(uname -s | tr '[:upper:]' '[:lower:]')" ARCH="$(uname -m)" case "$ARCH" in x86_64) ARCH="amd64" ;; arm64|aarch64) ARCH="arm64" ;; *) echo "Unsupported architecture: $ARCH"; exit 1 ;; esac TARGET_DIR="$HOME/.bath" mkdir -p "$TARGET_DIR"/{bin,include/bath,cmake,demo,deploy,proofs} DOWNLOAD_URL="https://bathanalytics.com/api/download?key=${LICENSE_KEY}&os=${OS}&arch=${ARCH}" echo "Fetching verified kernel and SDK archive from $DOWNLOAD_URL..." TMP_TAR="/tmp/bath-archive-$$.tar.gz" if curl -sSLf "$DOWNLOAD_URL" -o "$TMP_TAR"; then if tar -tzf "$TMP_TAR" >/dev/null 2>&1; then tar -xzf "$TMP_TAR" -C "$TARGET_DIR/" else mv "$TMP_TAR" "$TARGET_DIR/bin/bath" fi rm -f "$TMP_TAR" chmod -R +x "$TARGET_DIR/bin/"* 2>/dev/null || true echo "SUCCESS: Bath Analytics Kernel and C++ SDK extracted to $TARGET_DIR" echo "Add to PATH: export PATH=\"\$HOME/.bath/bin:\$PATH\"" else echo "ERROR: License verification failed or binary download rejected." rm -f "$TMP_TAR" exit 1 fi