1daacea468
- check_venv.sh prüft Existenz + Ausführbarkeit des Interpreters - Gibt bei Erfolg 0 zurück, sonst 1 mit klarer Fehlermeldung - Wird als ExecStartPre= in der systemd-Unit eingebunden Hinweis für Commander: Die systemd-Unit deploy/mc2-gateway.service muss nach Annahme manuell um ExecStartPre=... erweitert werden.
32 lines
1.1 KiB
Bash
Executable File
32 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Prüft, ob der Python-Interpreter im MC2-Virtualenv existiert und ausfuehrbar ist.
|
|
# Gibt bei Erfolg 0 zurueck, sonst 1 mit klarer Fehlermeldung.
|
|
#
|
|
# Aufruf: ./check_venv.sh
|
|
# Ziel-Pfad: /home/hitonabi/mission-control-v2/backend/.venv/bin/python
|
|
|
|
set -euo pipefail
|
|
|
|
VENV_PYTHON="/home/hitonabi/mission-control-v2/backend/.venv/bin/python"
|
|
|
|
if [[ ! -f "$VENV_PYTHON" ]]; then
|
|
echo "FEHLER: Python-Interpreter nicht gefunden: $VENV_PYTHON" >&2
|
|
echo "Hinweis: Virtualenv fuer MC2-Gateway wurde nicht erstellt oder ist beschädigt." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -x "$VENV_PYTHON" ]]; then
|
|
echo "FEHLER: Python-Interpreter nicht ausfuehrbar: $VENV_PYTHON" >&2
|
|
echo "Hinweis: Dateiberechtigungen pruefen." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Optional: Kurze Funktionspruefung (Version ausgeben, ohne Side Effects)
|
|
if ! "$VENV_PYTHON" --version >/dev/null 2>&1; then
|
|
echo "FEHLER: Python-Interpreter ist defekt oder fehlt essentielle Pakete." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "OK: Python-Interpreter ist verfuegbar: $VENV_PYTHON ($("$VENV_PYTHON" --version 2>&1 | head -n1))"
|
|
exit 0
|