#!/bin/sh set -e REPO="nimbus-solution/nimbus-releases" INSTALL_DIR="/usr/local/bin" BINARY="nimbus" # Detect OS OS=$(uname -s | tr '[:upper:]' '[:lower:]') case "$OS" in linux|darwin) ;; *) echo "Unsupported OS: $OS" >&2; exit 1 ;; esac # Detect architecture ARCH=$(uname -m) case "$ARCH" in x86_64) ARCH="amd64" ;; arm64|aarch64) ARCH="arm64" ;; *) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;; esac # Resolve latest version VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \ | grep '"tag_name"' \ | sed 's/.*"tag_name": *"v\([^"]*\)".*/\1/') if [ -z "$VERSION" ]; then echo "error: could not determine latest version" >&2 exit 1 fi FILENAME="${BINARY}_${VERSION}_${OS}_${ARCH}.tar.gz" URL="https://github.com/${REPO}/releases/download/v${VERSION}/${FILENAME}" echo "Installing nimbus v${VERSION} (${OS}/${ARCH})..." # Download and extract to a temp dir TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT curl -fsSL "$URL" -o "$TMP/$FILENAME" tar -xzf "$TMP/$FILENAME" -C "$TMP" # Install — fall back to ~/.local/bin if /usr/local/bin is not writable if [ ! -w "$INSTALL_DIR" ]; then INSTALL_DIR="$HOME/.local/bin" mkdir -p "$INSTALL_DIR" fi install -m 755 "$TMP/$BINARY" "$INSTALL_DIR/$BINARY" echo "nimbus v${VERSION} installed to $INSTALL_DIR/$BINARY" # Remind user to add to PATH if using the fallback location if [ "$INSTALL_DIR" = "$HOME/.local/bin" ]; then echo "" echo "Add to your PATH if needed:" echo " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc && source ~/.zshrc" fi