#!/usr/bin/env bash set -euo pipefail # GitProof 1-Line Installer # Usage: curl -fsSL https://gitproof.legendrail.com/install.sh | bash VERSION="${GITPROOF_VERSION:-v1.0.36}" GITHUB_REPO="LEGEND-Rail/gitproof-verify" RELEASE_BASE_URL="https://gitproof.legendrail.com/releases/${VERSION}" echo "đŸ›Ąī¸ Installing GitProof (${VERSION})..." # Detect OS OS="$(uname -s | tr '[:upper:]' '[:lower:]')" case "${OS}" in darwin*) OS_TARGET="darwin" ;; linux*) OS_TARGET="linux" ;; msys*|mingw*|cygwin*) OS_TARGET="windows" ;; *) echo "❌ Unsupported operating system: ${OS}" exit 1 ;; esac # Detect Architecture ARCH="$(uname -m)" case "${ARCH}" in x86_64|amd64) ARCH_TARGET="amd64" ;; arm64|aarch64) ARCH_TARGET="arm64" ;; *) echo "❌ Unsupported architecture: ${ARCH}" exit 1 ;; esac BINARY_NAME="gproof" [ "${OS_TARGET}" = "windows" ] && BINARY_NAME="gproof.exe" ASSET_NAME="gproof-${OS_TARGET}-${ARCH_TARGET}.tar.gz" [ "${OS_TARGET}" = "windows" ] && ASSET_NAME="gproof-${OS_TARGET}-${ARCH_TARGET}.zip" DOWNLOAD_URL="${RELEASE_BASE_URL}/${ASSET_NAME}" # Temporary download workspace TMP_DIR="$(mktemp -d)" trap 'rm -rf "${TMP_DIR}"' EXIT echo "âŦ‡ī¸ Downloading ${ASSET_NAME}..." if command -v curl >/dev/null 2>&1; then curl -fsSL "${DOWNLOAD_URL}" -o "${TMP_DIR}/${ASSET_NAME}" || { echo "âš ī¸ Release asset not yet published at ${DOWNLOAD_URL}." echo "â„šī¸ Building local executable from source..." if command -v go >/dev/null 2>&1; then cd "${TMP_DIR}" git clone --depth 1 "https://github.com/${GITHUB_REPO}.git" repo cd repo go build -o "${TMP_DIR}/${BINARY_NAME}" ./cmd/gitproof else echo "❌ Please install Go or check release URL." exit 1 fi } else echo "❌ curl is required to install GitProof" exit 1 fi if [ -f "${TMP_DIR}/${ASSET_NAME}" ]; then if [ "${OS_TARGET}" = "windows" ]; then unzip -q -o "${TMP_DIR}/${ASSET_NAME}" -d "${TMP_DIR}" [ -f "${TMP_DIR}/gproof-${OS_TARGET}-${ARCH_TARGET}.exe" ] && mv "${TMP_DIR}/gproof-${OS_TARGET}-${ARCH_TARGET}.exe" "${TMP_DIR}/${BINARY_NAME}" else tar -xzf "${TMP_DIR}/${ASSET_NAME}" -C "${TMP_DIR}" [ -f "${TMP_DIR}/gproof-${OS_TARGET}-${ARCH_TARGET}" ] && mv "${TMP_DIR}/gproof-${OS_TARGET}-${ARCH_TARGET}" "${TMP_DIR}/${BINARY_NAME}" fi fi # Determine target install directory INSTALL_DIR="/usr/local/bin" USE_SUDO="" if [ ! -w "${INSTALL_DIR}" ]; then if [ "$(id -u)" -eq 0 ]; then USE_SUDO="" elif [ -t 0 ] && command -v sudo >/dev/null 2>&1; then USE_SUDO="sudo" elif command -v sudo >/dev/null 2>&1 && sudo -n true 2>/dev/null; then USE_SUDO="sudo" else INSTALL_DIR="${HOME}/.local/bin" mkdir -p "${INSTALL_DIR}" USE_SUDO="" fi fi echo "đŸ“Ļ Installing ${BINARY_NAME} to ${INSTALL_DIR}..." ${USE_SUDO} install -m 755 "${TMP_DIR}/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}" # Create git-proof symlink for native 'git proof' integration SYMLINK_PATH="${INSTALL_DIR}/git-proof" if [ -L "${SYMLINK_PATH}" ] || [ -f "${SYMLINK_PATH}" ]; then ${USE_SUDO} rm -f "${SYMLINK_PATH}" fi ${USE_SUDO} ln -s "${INSTALL_DIR}/${BINARY_NAME}" "${SYMLINK_PATH}" # Check for Pro license key in environment if [ -n "${GITPROOF_KEY:-}" ]; then echo "🔑 Activating Pro license from GITPROOF_KEY..." "${INSTALL_DIR}/${BINARY_NAME}" auth "${GITPROOF_KEY}" || true elif [ -n "${GITPROOF_LICENSE_KEY:-}" ]; then echo "🔑 Activating Pro license from GITPROOF_LICENSE_KEY..." "${INSTALL_DIR}/${BINARY_NAME}" auth "${GITPROOF_LICENSE_KEY}" || true fi echo "✅ GitProof (${VERSION}) successfully installed!" if [[ ":$PATH:" != *":${INSTALL_DIR}:"* ]]; then echo "âš ī¸ Note: ${INSTALL_DIR} is not in your PATH." echo " Add it by running: export PATH=\"${INSTALL_DIR}:\$PATH\"" fi if [ -z "${GITPROOF_KEY:-}" ] && [ -z "${GITPROOF_LICENSE_KEY:-}" ] && [ ! -f "${HOME}/.gitproof/license" ]; then echo "âš ī¸ License Mode: COMMUNITY EVALUATION (Community seals are watermarked & cannot be upgraded retroactively)." echo "👉 Unlock Contemporaneous FRE 902 Court Exhibits & Corporate LLC binding (\$29/mo): run 'gproof buy'" fi echo "👉 Run 'gproof status' or 'gproof seal' to get started."