Files
2026-05-18 12:49:49 -04:00

47 lines
1001 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
host="$(hostname -s)"
case "$host" in
NytegearArch)
BEETS_ROOT="/data/Music/Beets"
BEETSDIR="/data/Music/Beets/config"
;;
NytegearMusic)
BEETS_ROOT="/music/beets"
BEETSDIR="/music/beets/config"
;;
*)
echo "Unknown beets host: $host" >&2
exit 2
;;
esac
VIRTUAL_ENV="$BEETS_ROOT/venv"
if [[ ! -x "$VIRTUAL_ENV/bin/python" ]]; then
echo "Missing venv Python: $VIRTUAL_ENV/bin/python" >&2
exit 1
fi
if [[ ! -x "$VIRTUAL_ENV/bin/beet" ]]; then
echo "Missing beet executable: $VIRTUAL_ENV/bin/beet" >&2
exit 1
fi
export VIRTUAL_ENV
export BEETSDIR
# Match the important part of venv activation without polluting the interactive shell.
export PATH="$VIRTUAL_ENV/bin:$PATH"
# Avoid weird inherited Python state.
unset PYTHONHOME
# Optional hardening: prevents accidental imports from user site-packages.
# Usually desirable for repeatability.
export PYTHONNOUSERSITE=1
exec "$VIRTUAL_ENV/bin/beet" "$@"