48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Always run from this script's directory.
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo "========================================"
|
|
echo " Tätigkeitsnachweis-Generator"
|
|
echo "========================================"
|
|
echo ""
|
|
|
|
# Prüfe ob Python verfügbar ist
|
|
if command -v python3 >/dev/null 2>&1; then
|
|
PYTHON_BIN="python3"
|
|
elif command -v python >/dev/null 2>&1; then
|
|
PYTHON_BIN="python"
|
|
else
|
|
echo "[FEHLER] Python wurde nicht gefunden."
|
|
echo "Bitte installiere Python 3.9 oder neuer von https://python.org"
|
|
exit 1
|
|
fi
|
|
|
|
echo "[INFO] Python gefunden:"
|
|
"$PYTHON_BIN" --version
|
|
|
|
# Prüfe ob venv existiert, sonst erstelle
|
|
VENV_DIR=".venv"
|
|
if [[ ! -x "$VENV_DIR/bin/python" ]]; then
|
|
if [[ -d "$VENV_DIR" ]]; then
|
|
echo "[INFO] Vorhandene venv ist nicht kompatibel. Erstelle neu..."
|
|
rm -rf "$VENV_DIR"
|
|
fi
|
|
echo "[INFO] Erstelle virtuelle Umgebung..."
|
|
"$PYTHON_BIN" -m venv "$VENV_DIR"
|
|
fi
|
|
|
|
# Aktiviere venv und installiere Abhängigkeiten
|
|
echo "[INFO] Installiere Abhängigkeiten..."
|
|
"$VENV_DIR/bin/pip" install -r requirements.txt --quiet
|
|
|
|
# Starte Streamlit
|
|
echo ""
|
|
echo "[INFO] Starte Tätigkeitsnachweis-Generator..."
|
|
echo "[INFO] Die App öffnet sich im Browser unter http://localhost:8501"
|
|
echo ""
|
|
"$VENV_DIR/bin/streamlit" run app.py
|