#!/bin/sh set -e BASE_URL="https://slicer.dive.ai" BINARY_NAME="slicer" INSTALL_DIR="/usr/local/bin" # Detect OS OS=$(uname -s | tr '[:upper:]' '[:lower:]') case "$OS" in linux) OS="linux" ;; darwin) OS="darwin" ;; *) echo "Error: Unsupported OS: $OS"; exit 1 ;; esac # Detect architecture ARCH=$(uname -m) case "$ARCH" in x86_64|amd64) ARCH="x64" ;; arm64|aarch64) ARCH="arm64" ;; *) echo "Error: Unsupported architecture: $ARCH"; exit 1 ;; esac echo "Detecting platform... ${OS}/${ARCH}" # Get latest version VERSION=$(curl -fsSL "${BASE_URL}/latest/version") if [ -z "$VERSION" ]; then echo "Error: Could not fetch latest version." exit 1 fi ASSET_NAME="${BINARY_NAME}-${OS}-${ARCH}" URL="${BASE_URL}/latest/${ASSET_NAME}" echo "Downloading ${BINARY_NAME} ${VERSION} (${OS}/${ARCH})..." curl -fsSL "$URL" -o "/tmp/${BINARY_NAME}" || { echo "Error: Failed to download ${URL}" echo "Check that a release exists for your platform." exit 1 } chmod +x "/tmp/${BINARY_NAME}" # Install if [ -w "$INSTALL_DIR" ]; then mv "/tmp/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}" else echo "Installing to ${INSTALL_DIR} (requires sudo)..." sudo mv "/tmp/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}" fi # Check Python if ! command -v python3 >/dev/null 2>&1; then echo "" echo "Warning: python3 not found. slicer requires Python 3 for PDF processing." echo "Install it with:" echo " macOS: brew install python3" echo " Linux: sudo apt install python3" echo "" fi echo "" echo "slicer ${VERSION} installed successfully!" echo "Run 'slicer' to get started."