#!/bin/sh # ModelStudio launcher installer — Ollama-style one-liner: # curl -fsSL https://raw.githubusercontent.com/manufactai/modelstudio-cli/main/install.sh | sh # # Detects your OS/arch, downloads the matching `modelstudio` binary from the latest GitHub # release, and installs it. Override the source repo with MODELSTUDIO_REPO, the version with # MODELSTUDIO_VERSION (default: latest), and the install dir with MODELSTUDIO_BIN_DIR. set -eu REPO="${MODELSTUDIO_REPO:-manufactai/modelstudio-cli}" VERSION="${MODELSTUDIO_VERSION:-latest}" # --- detect platform ------------------------------------------------------- OS="$(uname -s | tr '[:upper:]' '[:lower:]')" ARCH="$(uname -m)" case "$ARCH" in x86_64 | amd64) ARCH="amd64" ;; aarch64 | arm64) ARCH="arm64" ;; *) echo "modelstudio: unsupported architecture: $ARCH" >&2; exit 1 ;; esac case "$OS" in linux | darwin) : ;; *) echo "modelstudio: unsupported OS: $OS (Windows: download modelstudio-windows-amd64.exe from the releases page)" >&2; exit 1 ;; esac ASSET="modelstudio-${OS}-${ARCH}" if [ "$VERSION" = "latest" ]; then URL="https://github.com/${REPO}/releases/latest/download/${ASSET}" else URL="https://github.com/${REPO}/releases/download/${VERSION}/${ASSET}" fi # --- pick a writable install dir ------------------------------------------ if [ -n "${MODELSTUDIO_BIN_DIR:-}" ]; then BIN_DIR="$MODELSTUDIO_BIN_DIR" elif [ -w /usr/local/bin ] 2>/dev/null; then BIN_DIR="/usr/local/bin" elif command -v sudo >/dev/null 2>&1 && [ "$OS" != "darwin" ]; then BIN_DIR="/usr/local/bin"; SUDO="sudo" else BIN_DIR="$HOME/.local/bin" fi SUDO="${SUDO:-}" mkdir -p "$BIN_DIR" 2>/dev/null || $SUDO mkdir -p "$BIN_DIR" # --- download + install ---------------------------------------------------- TMP="$(mktemp)" trap 'rm -f "$TMP"' EXIT echo "Downloading $ASSET ($VERSION)…" if command -v curl >/dev/null 2>&1; then curl -fsSL "$URL" -o "$TMP" elif command -v wget >/dev/null 2>&1; then wget -qO "$TMP" "$URL" else echo "modelstudio: need curl or wget to download" >&2; exit 1 fi chmod +x "$TMP" $SUDO mv "$TMP" "$BIN_DIR/modelstudio" trap - EXIT echo "Installed modelstudio → $BIN_DIR/modelstudio" case ":$PATH:" in *":$BIN_DIR:"*) ;; *) echo "Note: $BIN_DIR is not on your PATH — add it, e.g. export PATH=\"$BIN_DIR:\$PATH\"" ;; esac echo echo "Next:" echo " modelstudio up # start the stack and open the UI" echo " modelstudio doctor # check your machine is ready"