#!/bin/sh # Legion CLI Installer — Linux/macOS # Usage: curl -fsSL https://legion-registry.hexabhhexabbh.workers.dev/install.sh | sh # Docs: https://legion-registry.hexabhhexabbh.workers.dev/docs set -e REGISTRY="https://legion-registry.hexabhhexabbh.workers.dev" INSTALL_DIR="${LEGION_INSTALL_DIR:-$HOME/.legion/bin}" BINARY="legion" VERSION="2.1.0" cyan() { printf '\033[96m%s\033[0m' "$1"; } green() { printf '\033[92m%s\033[0m' "$1"; } red() { printf '\033[91m%s\033[0m' "$1"; } bold() { printf '\033[1m%s\033[0m' "$1"; } echo "" echo " $(bold '⚡ Legion CLI Installer') v${VERSION}" echo "" # Detect platform OS="$(uname -s)" ARCH="$(uname -m)" case "$OS" in Linux*) PLATFORM="linux-x64" ;; Darwin*) PLATFORM="macos-x64" ;; *) echo " $(red '✗ Unsupported OS:') $OS" && exit 1 ;; esac echo " Platform: $(cyan "$PLATFORM")" # Download URL — served from legionhjyu-docs.pages.dev DOWNLOAD_URL="https://legionhjyu-docs.pages.dev/downloads/legion-${PLATFORM}" echo " Downloading: $(cyan "$DOWNLOAD_URL")" echo "" # Create install dir mkdir -p "$INSTALL_DIR" # Download binary if command -v curl >/dev/null 2>&1; then curl -fsSL "$DOWNLOAD_URL" -o "$INSTALL_DIR/$BINARY" elif command -v wget >/dev/null 2>&1; then wget -q "$DOWNLOAD_URL" -O "$INSTALL_DIR/$BINARY" else echo " $(red '✗ curl or wget required')" && exit 1 fi chmod +x "$INSTALL_DIR/$BINARY" echo " $(green '✓ Installed to:') $INSTALL_DIR/$BINARY" echo "" echo " Add to PATH (add to ~/.bashrc or ~/.zshrc):" echo " export PATH=\"\$HOME/.legion/bin:\$PATH\"" echo "" echo " Try it:" echo " $(cyan 'legion --version')" echo " $(cyan 'legion pkg help')" echo " $(cyan 'legion pkg search colors')" echo ""