diff --git a/README.md b/README.md index 99f3b6c..78a2338 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ pip install -r requirements.txt streamlit run app.py ``` -Oder einfach `start.bat` doppelklicken (Windows). +Oder einfach `start.bat` (Windows) bzw. `./start.sh` (macOS/Linux) ausführen. ## Bedienung diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..be2d6a1 --- /dev/null +++ b/start.sh @@ -0,0 +1,47 @@ +#!/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