- hatch_build.py: custom hatchling build hook that compiles the React frontend (npm ci + build) when frontend/dist is missing or stale, so 'uv tool install git+https://gitea.zephyre.one/Pakobbix/nvcurve.git' works as a single command - install.sh: curl|bash installer (checks prerequisites, auto-installs uv, clones and installs) - Makefile: dev targets (frontend, install, dev, test, clean) - README/docs: document the one-liner, clone, and direct-git installs
62 lines
2.0 KiB
Bash
Executable File
62 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# NVCurve single-command installer.
|
|
#
|
|
# curl -fsSL https://gitea.zephyre.one/Pakobbix/nvcurve/raw/branch/main/install.sh | bash
|
|
#
|
|
# or from a local clone:
|
|
#
|
|
# git clone https://gitea.zephyre.one/Pakobbix/nvcurve.git && cd nvcurve && ./install.sh
|
|
#
|
|
# The React frontend is compiled automatically during the Python build
|
|
# (see hatch_build.py), so Node.js 18+ and npm must be available.
|
|
#
|
|
# Environment:
|
|
# NVCURVE_BRANCH branch to install (default: main)
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_URL="https://gitea.zephyre.one/Pakobbix/nvcurve.git"
|
|
BRANCH="${NVCURVE_BRANCH:-main}"
|
|
|
|
fail() {
|
|
echo "error: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
# --- prerequisites -----------------------------------------------------------
|
|
command -v git >/dev/null 2>&1 \
|
|
|| fail "git is required. Install it first."
|
|
command -v node >/dev/null 2>&1 \
|
|
|| fail "Node.js 18+ is required (e.g. 'sudo pacman -S nodejs npm' or 'sudo apt install nodejs npm')."
|
|
command -v npm >/dev/null 2>&1 \
|
|
|| fail "npm is required (usually installed together with Node.js)."
|
|
|
|
if ! command -v uv >/dev/null 2>&1; then
|
|
echo "uv not found — installing it from https://astral.sh/uv ..."
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
command -v uv >/dev/null 2>&1 \
|
|
|| fail "uv installation failed. Install uv manually: https://docs.astral.sh/uv/"
|
|
fi
|
|
|
|
# --- locate the source tree ---------------------------------------------------
|
|
if [ -f pyproject.toml ] && [ -d frontend ]; then
|
|
src="$(pwd)"
|
|
echo "Installing from current directory: $src"
|
|
else
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
echo "Cloning $REPO_URL (branch: $BRANCH) ..."
|
|
git clone --quiet --depth 1 --branch "$BRANCH" "$REPO_URL" "$tmp/nvcurve"
|
|
src="$tmp/nvcurve"
|
|
fi
|
|
|
|
# --- install -------------------------------------------------------------------
|
|
# The frontend is built automatically by the build hook (hatch_build.py).
|
|
uv tool install --force "$src"
|
|
|
|
echo
|
|
echo "NVCurve installed."
|
|
echo " Verify your GPU: nvcurve setup"
|
|
echo " Start the web UI: nvcurve" |