#!/bin/bash # Installs or updates Paprika on a Mac. Run it again to update. # curl -fsSL https://keeno.dev/install.sh | bash # PAPRIKA_INSTALL_DIR: where the code goes (default ~/Projects/paprika-recorder). # PAPRIKA_TARBALL_URL: a release tarball to install from (default: the latest release on keeno.dev). # PAPRIKA_SKIP_SETUP=1: stop before `paprika setup` (for testing; setup changes Claude Code's and Blender's config). set -euo pipefail DEFAULT_TARBALL_URL="https://keeno.dev/paprika.tar.gz" REPO_URL="https://github.com/jcreeno77/Paprika.git" DIR="${PAPRIKA_INSTALL_DIR:-$HOME/Projects/paprika-recorder}" say() { printf '\n==> %s\n' "$*"; } # Everything runs from main, so a download cut off halfway runs nothing. main() { if [ "$(uname -s)" != "Darwin" ]; then echo "Paprika runs only on macOS." >&2 exit 1 fi cat </dev/null 2>&1; then say "Installing Xcode's command-line tools. Click Install in the window that opens." xcode-select --install || true until xcode-select -p >/dev/null 2>&1; do sleep 5; done fi if ! command -v bun >/dev/null 2>&1 && [ ! -x "$HOME/.bun/bin/bun" ]; then say "Installing Bun" curl -fsSL https://bun.sh/install | bash fi export PATH="$HOME/.bun/bin:$PATH" get_code say "Installing Paprika's packages" cd "$DIR" bun install --frozen-lockfile bun link if [ "${PAPRIKA_SKIP_SETUP:-}" = 1 ]; then say "Stopped before setup (PAPRIKA_SKIP_SETUP=1). Paprika's code is in $DIR." exit 0 fi say "Running Paprika setup" if command -v paprika >/dev/null 2>&1; then paprika setup --yes; else bun run src/cli.ts setup --yes; fi say "Paprika is installed. Open http://127.0.0.1:4747 to see what Paprika recorded." } # A git checkout (a developer's) updates with git; otherwise the release tarball, then git clone for people with access. get_code() { if [ -d "$DIR/.git" ]; then say "Updating $DIR with git" git -C "$DIR" pull --ff-only return fi if [ -e "$DIR" ] && ! grep -qs '"name": "paprika-recorder"' "$DIR/package.json"; then echo "$DIR exists and isn't Paprika. Set PAPRIKA_INSTALL_DIR to another folder." >&2 exit 1 fi mkdir -p "$(dirname "$DIR")" local tmp tmp="$(mktemp -d "$(dirname "$DIR")/.paprika-XXXXXX")" if curl -fsSL "${PAPRIKA_TARBALL_URL:-$DEFAULT_TARBALL_URL}" -o "$tmp/paprika.tar.gz"; then say "Unpacking Paprika into $DIR" # Unpack beside the old copy, then swap, so files removed in a new release don't linger. mkdir "$tmp/new" tar -xzf "$tmp/paprika.tar.gz" -C "$tmp/new" --strip-components=1 rm -rf "$DIR" mv "$tmp/new" "$DIR" elif [ -n "${PAPRIKA_TARBALL_URL:-}" ]; then rm -rf "$tmp" echo "Couldn't download $PAPRIKA_TARBALL_URL." >&2 exit 1 else say "No release found; cloning $REPO_URL" rm -rf "$tmp" GIT_TERMINAL_PROMPT=0 git clone "$REPO_URL" "$DIR" || { echo "Couldn't download Paprika. Ask for a release link and run: PAPRIKA_TARBALL_URL= bash install.sh" >&2 exit 1 } return fi rm -rf "$tmp" } main "$@"