📝 "Update README and setup documentation with Gitmoji emojis" 🌟

This commit is contained in:
2025-06-02 12:30:26 +02:00
parent c1b0353ac5
commit b5fca69a0f
3 changed files with 447 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ set -euo pipefail
# =========================== GLOBALE KONFIGURATION ===========================
readonly APP_NAME="MYP Druckerverwaltung"
readonly APP_VERSION="4.0.0"
readonly APP_VERSION="4.0.4"
readonly APP_DIR="/opt/myp"
readonly HTTPS_SERVICE_NAME="myp-https"
readonly KIOSK_SERVICE_NAME="myp-kiosk"
@@ -88,22 +88,114 @@ check_debian_system() {
}
check_internet_connection() {
progress "Prüfe Internetverbindung..."
progress "Prüfe Internetverbindung (mehrere Methoden)..."
local test_urls=("8.8.8.8" "1.1.1.1" "google.com")
local connection_ok=false
local test_method=""
for url in "${test_urls[@]}"; do
if ping -c 1 -W 3 "$url" >/dev/null 2>&1; then
connection_ok=true
break
# Methode 1: HTTP/HTTPS-Tests (robust für Firewalls/Proxys)
progress "Teste HTTP/HTTPS-Verbindungen..."
local http_urls=("http://detectportal.firefox.com/success.txt" "https://www.google.com" "http://httpbin.org/get")
for url in "${http_urls[@]}"; do
if command -v curl >/dev/null 2>&1; then
if curl -s --connect-timeout 5 --max-time 10 "$url" >/dev/null 2>&1; then
connection_ok=true
test_method="HTTP/HTTPS (curl: $url)"
break
fi
elif command -v wget >/dev/null 2>&1; then
if wget -q --timeout=5 --tries=1 "$url" -O /dev/null 2>/dev/null; then
connection_ok=true
test_method="HTTP/HTTPS (wget: $url)"
break
fi
fi
done
# Methode 2: DNS-Auflösung testen (falls HTTP fehlschlägt)
if [ "$connection_ok" = false ]; then
progress "Teste DNS-Auflösung..."
local dns_hosts=("google.com" "cloudflare.com" "github.com")
for host in "${dns_hosts[@]}"; do
if command -v nslookup >/dev/null 2>&1; then
if nslookup "$host" >/dev/null 2>&1; then
connection_ok=true
test_method="DNS-Auflösung (nslookup: $host)"
break
fi
elif command -v dig >/dev/null 2>&1; then
if dig +short "$host" >/dev/null 2>&1; then
connection_ok=true
test_method="DNS-Auflösung (dig: $host)"
break
fi
elif getent hosts "$host" >/dev/null 2>&1; then
connection_ok=true
test_method="DNS-Auflösung (getent: $host)"
break
fi
done
fi
# Methode 3: ICMP-Ping (nur als letzter Fallback)
if [ "$connection_ok" = false ]; then
progress "Teste ICMP-Ping (Fallback)..."
local ping_hosts=("8.8.8.8" "1.1.1.1" "9.9.9.9")
for host in "${ping_hosts[@]}"; do
if ping -c 1 -W 3 "$host" >/dev/null 2>&1; then
connection_ok=true
test_method="ICMP-Ping ($host)"
break
fi
done
fi
# Methode 4: Routing-Tabelle prüfen (offline detection)
if [ "$connection_ok" = false ]; then
progress "Prüfe Netzwerk-Routing..."
if ip route show default >/dev/null 2>&1; then
local default_gw=$(ip route show default | awk '/default/ {print $3}' | head -1)
if [ -n "$default_gw" ]; then
if ping -c 1 -W 2 "$default_gw" >/dev/null 2>&1; then
# Gateway erreichbar, aber Internet möglicherweise eingeschränkt
connection_ok=true
test_method="Lokales Netzwerk (Gateway: $default_gw) - Internet möglicherweise eingeschränkt"
fi
fi
fi
fi
# Ergebnis-Bewertung und Logging
if [ "$connection_ok" = true ]; then
log "✅ Internetverbindung verfügbar"
success "✅ Internetverbindung verfügbar"
info " 🔍 Erkannt via: $test_method"
# Zusätzliche Informationen für Debugging
if command -v curl >/dev/null 2>&1; then
local external_ip=$(curl -s --connect-timeout 3 ifconfig.me 2>/dev/null || curl -s --connect-timeout 3 ipinfo.io/ip 2>/dev/null || echo "Unbekannt")
if [ "$external_ip" != "Unbekannt" ]; then
info " 🌐 Externe IP: $external_ip"
fi
fi
else
warning "⚠️ Keine Internetverbindung - Installation könnte fehlschlagen"
warning "⚠️ Keine Internetverbindung erkannt"
info " → Installation wird fortgesetzt, könnte aber bei Paket-Downloads fehlschlagen"
info " → Stellen Sie sicher, dass apt-get update funktioniert"
# Hilfreich für Debugging
info " 🔍 Debug-Informationen:"
if command -v ip >/dev/null 2>&1; then
local default_gw=$(ip route show default | awk '/default/ {print $3}' | head -1 2>/dev/null || echo "Kein Gateway")
info " - Default Gateway: $default_gw"
fi
if [ -f /etc/resolv.conf ]; then
local dns_servers=$(grep -E "^nameserver" /etc/resolv.conf | awk '{print $2}' | tr '\n' ' ' || echo "Keine DNS-Server")
info " - DNS-Server: $dns_servers"
fi
fi
}
@@ -949,7 +1041,7 @@ deploy_application() {
# MYP Application Environment
MYP_APP_DIR=$APP_DIR
PYTHONPATH=$APP_DIR:\$PYTHONPATH
PYTHONPATH=$APP_DIR
EOF
# Bash-Profile für Root und Standard-User aktualisieren
@@ -960,7 +1052,11 @@ EOF
# MYP Application Environment
if [ -d "/opt/myp" ]; then
export MYP_APP_DIR="/opt/myp"
export PYTHONPATH="/opt/myp:$PYTHONPATH"
if [ -z "${PYTHONPATH:-}" ]; then
export PYTHONPATH="/opt/myp"
else
export PYTHONPATH="/opt/myp:$PYTHONPATH"
fi
fi
EOF
log "✅ Bash-Profile aktualisiert: $user_home/.bashrc"
@@ -1306,12 +1402,27 @@ except Exception as e:
# Erstelle sichere Test-Umgebung
export FLASK_ENV=testing
export MYP_TESTING=1
export PYTHONPATH="$APP_DIR:$PYTHONPATH"
# Robuste PYTHONPATH-Konfiguration
if [ -z "${PYTHONPATH:-}" ]; then
export PYTHONPATH="$APP_DIR"
else
export PYTHONPATH="$APP_DIR:$PYTHONPATH"
fi
if timeout 30 python3 -c "
import sys
import os
sys.path.insert(0, os.getcwd())
# Sichere Python-Pfad-Konfiguration
current_dir = os.getcwd()
app_dir = '$APP_DIR'
# Pfade hinzufügen
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
if app_dir not in sys.path:
sys.path.insert(0, app_dir)
# Setze Test-Umgebung
os.environ['FLASK_ENV'] = 'testing'
@@ -1327,19 +1438,40 @@ try:
print('✅ Flask-App-Objekt verfügbar')
else:
print('⚠️ Flask-App-Objekt nicht gefunden')
exit(1)
sys.exit(1)
except ImportError as ie:
print(f'❌ Import-Fehler: {str(ie)}')
exit(1)
print('❌ Import-Fehler: ' + str(ie))
sys.exit(1)
except Exception as e:
print(f'⚠️ App-Import-Problem: {str(e)}')
exit(1)
" 2>/dev/null; then
print('⚠️ App-Import-Problem: ' + str(e))
sys.exit(1)
" 2>&1; then
success "✅ Flask-App kann erfolgreich importiert werden"
else
warning "⚠️ Flask-App-Import hat Probleme - möglicherweise fehlende optionale Abhängigkeiten"
warning " → Das ist normal für minimale Installation - App sollte trotzdem funktionieren"
# Zusätzliche Diagnose bei Import-Problemen
progress "Führe erweiterte Diagnose durch..."
# Prüfe ob Python-Module grundsätzlich findbar sind
if python3 -c "import sys; print('Python-Pfad:', sys.path)" 2>/dev/null; then
info "✅ Python-System funktioniert grundsätzlich"
fi
# Prüfe ob App-Verzeichnis korrekt ist
if [ -f "$APP_DIR/app.py" ]; then
info "✅ App-Datei gefunden: $APP_DIR/app.py"
else
warning "❌ App-Datei nicht gefunden: $APP_DIR/app.py"
fi
# Zeige installierte Python-Pakete
if command -v pip3 >/dev/null 2>&1; then
info "📋 Installierte Kernpakete:"
pip3 list | grep -E "(Flask|Werkzeug|SQLAlchemy|bcrypt)" | head -5 || info " Keine Kernpakete sichtbar"
fi
fi
cd "$CURRENT_DIR"