46ba53631a
release / release (push) Successful in 22s
- install.sh: no-root user-local install (private venv + ~/.local/bin launchers + desktop entry); --ref <tag> to install a specific release, --uninstall to remove; auto-installs the python3-venv prerequisite with consent - packaging/make-run.sh: build a self-extracting .run installer (makeself) bundling the wheel + install.sh; release workflow builds and attaches it - M13 self-update apply: `rigdoctor update` runs an authenticated pip upgrade (rigdoctor[gui] @ git+https://oauth2:<token>@...@<tag>), token scrubbed; GUI sidebar "Update to v…" button applies it and prompts to restart - version 0.0.7, CHANGELOG, docs (M9/M13, ROADMAP, README install section) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
104 lines
3.9 KiB
Bash
Executable File
104 lines
3.9 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# RigDoctor user-local installer (no root). Creates a private venv, links the
|
|
# `rigdoctor` / `rigdoctor-gui` commands into ~/.local/bin, and adds a desktop
|
|
# entry. Installs from a bundled wheel (the .run installer) or from a source
|
|
# checkout. Re-run to upgrade; `./install.sh --uninstall` to remove.
|
|
set -eu
|
|
|
|
APP_NAME=rigdoctor
|
|
DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
VENV="$DATA_HOME/$APP_NAME/venv"
|
|
BIN_DIR="$HOME/.local/bin"
|
|
DESKTOP_DIR="$DATA_HOME/applications"
|
|
DESKTOP_FILE="$DESKTOP_DIR/rigdoctor.desktop"
|
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
|
|
uninstall() {
|
|
echo "Removing RigDoctor user-local install…"
|
|
rm -rf "$VENV"
|
|
rm -f "$BIN_DIR/rigdoctor" "$BIN_DIR/rigdoctor-gui" "$DESKTOP_FILE"
|
|
echo "Done. (Config and logs under ~/.config/rigdoctor and ~/.local/share/rigdoctor were kept.)"
|
|
}
|
|
|
|
REF=""
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--uninstall) uninstall; exit 0 ;;
|
|
--ref) REF="${2:-}"; [ -n "$REF" ] || { echo "--ref needs a tag"; exit 1; }; shift 2 ;;
|
|
-h|--help) echo "Usage: install.sh [--ref <tag>] [--uninstall]"; exit 0 ;;
|
|
*) echo "Unknown option: $1"; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
PY=python3
|
|
command -v "$PY" >/dev/null 2>&1 || { echo "python3 not found — install Python 3.11+."; exit 1; }
|
|
"$PY" - <<'EOF' || { echo "Python 3.11+ is required."; exit 1; }
|
|
import sys
|
|
sys.exit(0 if sys.version_info >= (3, 11) else 1)
|
|
EOF
|
|
|
|
# venv support (ensurepip) is required; install python3-venv if it's missing.
|
|
if ! "$PY" -c "import ensurepip" >/dev/null 2>&1; then
|
|
PYVER=$("$PY" -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
|
|
PKGS="python3-venv python${PYVER}-venv"
|
|
echo "Python venv support is missing — needs: $PKGS"
|
|
if command -v pkexec >/dev/null 2>&1; then ESC=pkexec
|
|
elif command -v sudo >/dev/null 2>&1; then ESC=sudo
|
|
else ESC=""; fi
|
|
if [ -n "$ESC" ] && command -v apt-get >/dev/null 2>&1; then
|
|
echo "Installing $PKGS (you may be prompted for your password)…"
|
|
"$ESC" sh -c "apt-get update && apt-get install -y $PKGS" \
|
|
|| { echo "Failed. Install manually: sudo apt install $PKGS"; exit 1; }
|
|
else
|
|
echo "Install it manually, then re-run: sudo apt install $PKGS"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Where to install from: a specific released tag (--ref), a bundled wheel, or source.
|
|
WHEEL=$(ls "$SCRIPT_DIR"/rigdoctor-*.whl 2>/dev/null | head -n1 || true)
|
|
if [ -n "$REF" ]; then
|
|
CONF="${XDG_CONFIG_HOME:-$HOME/.config}/rigdoctor/token"
|
|
TOKEN="${RIGDOCTOR_TOKEN:-$(cat "$CONF" 2>/dev/null || true)}"
|
|
[ -n "$TOKEN" ] || { echo "--ref needs a token (run 'rigdoctor login' or set RIGDOCTOR_TOKEN)."; exit 1; }
|
|
SRC="rigdoctor[gui] @ git+https://oauth2:$TOKEN@git.jesseyvanofferen.com/jessey/rigdoctor.git@$REF"
|
|
elif [ -n "$WHEEL" ]; then
|
|
SRC="$WHEEL[gui]"
|
|
elif [ -f "$SCRIPT_DIR/pyproject.toml" ]; then
|
|
SRC="$SCRIPT_DIR[gui]"
|
|
else
|
|
echo "No bundled wheel or source found next to the installer."
|
|
exit 1
|
|
fi
|
|
|
|
echo "Creating venv at $VENV…"
|
|
"$PY" -m venv "$VENV"
|
|
"$VENV/bin/pip" install --upgrade pip >/dev/null
|
|
echo "Installing RigDoctor (pulls in PySide6 — this can take a minute)…"
|
|
"$VENV/bin/pip" install "$SRC"
|
|
|
|
mkdir -p "$BIN_DIR"
|
|
ln -sf "$VENV/bin/rigdoctor" "$BIN_DIR/rigdoctor"
|
|
ln -sf "$VENV/bin/rigdoctor-gui" "$BIN_DIR/rigdoctor-gui"
|
|
|
|
mkdir -p "$DESKTOP_DIR"
|
|
cat > "$DESKTOP_FILE" <<EOF
|
|
[Desktop Entry]
|
|
Type=Application
|
|
Name=RigDoctor
|
|
Comment=Hardware monitoring & crash diagnostics for Linux gamers
|
|
Exec=$VENV/bin/rigdoctor-gui
|
|
Icon=utilities-system-monitor
|
|
Terminal=false
|
|
Categories=System;Monitor;Utility;
|
|
EOF
|
|
|
|
echo
|
|
echo "RigDoctor $("$VENV/bin/rigdoctor" --version 2>/dev/null | awk '{print $2}') installed."
|
|
echo " GUI: rigdoctor-gui (or find 'RigDoctor' in your app menu)"
|
|
echo " CLI: rigdoctor --help"
|
|
case ":$PATH:" in
|
|
*":$BIN_DIR:"*) ;;
|
|
*) echo " Note: add $BIN_DIR to your PATH (a fresh login usually does this).";;
|
|
esac
|