#!/usr/bin/env sh # Build a self-extracting .run installer: bundles the wheel + install.sh so a user # can download one file, run it, and get a no-root user-local install. # # Requires `makeself` (apt install makeself). Run from the repo root. set -eu ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) cd "$ROOT" command -v makeself >/dev/null 2>&1 || { echo "makeself not found. Install it: sudo apt install makeself" exit 1 } VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])") mkdir -p dist # Build the wheel if it isn't already in dist/. if ! ls dist/rigdoctor-"$VERSION"-py3-none-any.whl >/dev/null 2>&1; then python3 -m build --wheel fi STAGE=$(mktemp -d) cp dist/rigdoctor-"$VERSION"-py3-none-any.whl "$STAGE"/ cp install.sh "$STAGE"/install.sh chmod +x "$STAGE/install.sh" OUT="dist/rigdoctor-$VERSION-installer.run" makeself --notemp-suffix "$STAGE" "$OUT" "RigDoctor $VERSION installer" ./install.sh rm -rf "$STAGE" echo "Built $OUT" echo "Run it with: chmod +x $OUT && ./$OUT"