Files
meetrec/install.sh
T
fegger 18ce1c134c Initial commit: MeetRec — record & transcribe meetings with Whisper
- meetrec.py: CLI recorder with live rolling transcript (faster-whisper)
- meetrec_gui.py: PySide6 GUI reusing the CLI's recording/transcription
  logic, with model/device/compute selection and live transcript
- install.sh: local install into ~/.local (venv, deps, launchers,
  desktop entry), with --model/--no-model/--uninstall
- bin/meetrec, bin/meetrec-cli: launchers
- share/applications/meetrec.desktop: XDG desktop entry
- README.md, requirements.txt, .gitignore
2026-09-07 09:38:32 +02:00

136 lines
4.6 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# install.sh — install MeetRec (GUI + CLI) into a local prefix.
#
# Usage:
# ./install.sh install, pre-downloading the 'small' model
# ./install.sh --model base pre-download a different Whisper model
# ./install.sh --no-model skip the model pre-download
# ./install.sh --uninstall remove everything the installer created
#
# Environment:
# PREFIX install prefix (default: $HOME/.local)
# PYTHON Python interpreter to use (default: python3)
set -euo pipefail
PREFIX="${PREFIX:-$HOME/.local}"
APP_DIR="$PREFIX/share/meetrec"
VENV="$APP_DIR/venv"
BIN_DIR="$PREFIX/bin"
DESKTOP_DIR="$PREFIX/share/applications"
PYTHON="${PYTHON:-python3}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODEL="small"
DOWNLOAD_MODEL=1
UNINSTALL=0
while [ $# -gt 0 ]; do
case "$1" in
--model)
[ $# -ge 2 ] || { echo "error: --model needs a value" >&2; exit 1; }
MODEL="$2"
shift 2
;;
--no-model) DOWNLOAD_MODEL=0; shift ;;
--uninstall) UNINSTALL=1; shift ;;
-h|--help)
sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//'
exit 0
;;
*)
echo "error: unknown option: $1" >&2
echo "try: ./install.sh --help" >&2
exit 1
;;
esac
done
# ---------------------------------------------------------------- uninstall
if [ "$UNINSTALL" = 1 ]; then
echo "Uninstalling MeetRec from $PREFIX ..."
rm -rf "$APP_DIR"
rm -f "$BIN_DIR/meetrec" "$BIN_DIR/meetrec-cli"
rm -f "$DESKTOP_DIR/meetrec.desktop"
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database "$DESKTOP_DIR" 2>/dev/null || true
fi
echo "Done. (Whisper models remain in ~/.cache/huggingface — remove that if you want them gone.)"
exit 0
fi
# ------------------------------------------------------------------- checks
echo "==> Checking prerequisites"
if ! command -v "$PYTHON" >/dev/null 2>&1; then
echo "error: $PYTHON not found. Install Python 3.10+ first." >&2
exit 1
fi
if ! "$PYTHON" -c 'import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)'; then
echo "error: Python 3.10+ required, found: $("$PYTHON" --version 2>&1)" >&2
exit 1
fi
if ! command -v pactl >/dev/null 2>&1; then
echo "warning: 'pactl' not found — is PipeWire/PulseAudio running?"
echo " On Arch: sudo pacman -S pipewire pipewire-pulse"
fi
if ! command -v aplay >/dev/null 2>&1 && ! command -v arecord >/dev/null 2>&1; then
echo "warning: ALSA utils not found — recording may not work."
fi
# -------------------------------------------------------------------- install
echo "==> Installing app to $APP_DIR"
mkdir -p "$APP_DIR" "$BIN_DIR" "$DESKTOP_DIR"
cp "$SCRIPT_DIR/meetrec.py" "$SCRIPT_DIR/meetrec_gui.py" "$SCRIPT_DIR/requirements.txt" "$APP_DIR/"
echo "==> Creating virtualenv"
if ! "$PYTHON" -m venv "$VENV"; then
echo "error: could not create a venv." >&2
echo " Debian/Ubuntu: sudo apt install python3-venv" >&2
echo " Arch: sudo pacman -S python-virtualenv (or ensure python3-venv)" >&2
exit 1
fi
"$VENV/bin/pip" install --upgrade pip --quiet
echo "==> Installing Python dependencies (numpy, sounddevice, faster-whisper, pyside6)"
"$VENV/bin/pip" install -r "$APP_DIR/requirements.txt"
echo "==> Installing launchers into $BIN_DIR"
install -m 0755 "$SCRIPT_DIR/bin/meetrec" "$BIN_DIR/meetrec"
install -m 0755 "$SCRIPT_DIR/bin/meetrec-cli" "$BIN_DIR/meetrec-cli"
echo "==> Installing XDG desktop entry"
install -m 0644 "$SCRIPT_DIR/share/applications/meetrec.desktop" \
"$DESKTOP_DIR/meetrec.desktop"
if command -v update-desktop-database >/dev/null 2>&1; then
update-desktop-database "$DESKTOP_DIR" 2>/dev/null || true
fi
if [ "$DOWNLOAD_MODEL" = 1 ]; then
echo "==> Pre-downloading Whisper model '$MODEL' (first run only, can take a while)"
"$VENV/bin/python" - <<EOF || echo "warning: model pre-download failed — it will download on first use."
from faster_whisper import WhisperModel
WhisperModel("$MODEL", device="cpu", compute_type="int8")
EOF
fi
# ----------------------------------------------------------------- summary
echo
echo "Installed MeetRec to $PREFIX"
echo
echo " GUI: meetrec (also available from your app menu as 'MeetRec')"
echo " CLI: meetrec-cli --help"
echo " Uninstall: ./install.sh --uninstall"
echo
if [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
echo "note: $BIN_DIR is not in your PATH. Add it, e.g.:"
echo " echo 'export PATH=\"$BIN_DIR:\$PATH\"' >> ~/.bashrc"
fi