"Refactor guest blueprint and related files for improved maintainability (feat)"
This commit is contained in:
@@ -46,9 +46,21 @@ echo
|
||||
APP_USER="myp"
|
||||
KIOSK_USER="kiosk"
|
||||
APP_DIR="/opt/myp-druckerverwaltung"
|
||||
BACKUP_DIR="/opt/myp-backups"
|
||||
SERVICE_NAME="myp-druckerverwaltung"
|
||||
KIOSK_SERVICE_NAME="myp-kiosk"
|
||||
KIOSK_URL="http://localhost"
|
||||
CURRENT_DIR="$(pwd)"
|
||||
|
||||
# System-Pfade
|
||||
SYSTEMD_DIR="/etc/systemd/system"
|
||||
NGINX_SITES_AVAILABLE="/etc/nginx/sites-available"
|
||||
NGINX_SITES_ENABLED="/etc/nginx/sites-enabled"
|
||||
LIGHTDM_CONF="/etc/lightdm/lightdm.conf"
|
||||
LOCAL_BIN="/usr/local/bin"
|
||||
CRON_DIR="/etc/cron.d"
|
||||
KIOSK_HOME="/home/$KIOSK_USER"
|
||||
PI_HOME="/home/pi"
|
||||
|
||||
# Bereinige unbenötigte Pakete (entsprechend offizieller Anleitung)
|
||||
log "Entferne unbenötigte Pakete zur Speicheroptimierung..."
|
||||
@@ -123,7 +135,7 @@ if [ ! -d "$APP_DIR/.git" ]; then
|
||||
log "Kopiere Anwendung..."
|
||||
if [ -f "app.py" ]; then
|
||||
log "Kopiere lokale Anwendung..."
|
||||
cp -r . "$APP_DIR/"
|
||||
cp -r "$CURRENT_DIR"/* "$APP_DIR/"
|
||||
chown -R "$APP_USER:$APP_USER" "$APP_DIR"
|
||||
else
|
||||
error "Anwendungsdateien nicht gefunden. Führe das Skript im Anwendungsverzeichnis aus."
|
||||
@@ -131,7 +143,7 @@ if [ ! -d "$APP_DIR/.git" ]; then
|
||||
else
|
||||
log "Anwendung bereits vorhanden, aktualisiere..."
|
||||
cd "$APP_DIR"
|
||||
sudo -u "$APP_USER" git pull
|
||||
sudo -u "$APP_USER" git pull || log "Git pull nicht möglich - lokale Installation"
|
||||
fi
|
||||
|
||||
cd "$APP_DIR"
|
||||
@@ -143,7 +155,7 @@ sudo -u "$APP_USER" ./venv/bin/pip install --upgrade pip
|
||||
|
||||
# Installiere Python-Abhängigkeiten
|
||||
log "Installiere Python-Abhängigkeiten..."
|
||||
if [ -f "requirements.txt" ]; then
|
||||
if [ -f "$CURRENT_DIR/requirements.txt" ]; then
|
||||
# Erstelle korrigierte requirements.txt ohne Verweis auf andere Datei
|
||||
cat > "$APP_DIR/requirements_fixed.txt" << 'EOF'
|
||||
# MYP Platform - Python Dependencies
|
||||
@@ -182,12 +194,12 @@ else
|
||||
fi
|
||||
|
||||
# Node.js Abhängigkeiten installieren
|
||||
if [ -f "package.json" ]; then
|
||||
if [ -f "$CURRENT_DIR/package.json" ]; then
|
||||
log "Installiere Node.js Abhängigkeiten..."
|
||||
sudo -u "$APP_USER" npm install
|
||||
|
||||
# Baue Frontend-Assets falls Tailwind vorhanden
|
||||
if [ -f "tailwind.config.js" ]; then
|
||||
if [ -f "$CURRENT_DIR/tailwind.config.js" ]; then
|
||||
log "Baue Frontend-Assets mit Tailwind CSS..."
|
||||
sudo -u "$APP_USER" npm run build:css || true
|
||||
fi
|
||||
@@ -195,7 +207,7 @@ fi
|
||||
|
||||
# Datenbank initialisieren
|
||||
log "Initialisiere Datenbank..."
|
||||
if [ -f "models.py" ]; then
|
||||
if [ -f "$CURRENT_DIR/models.py" ]; then
|
||||
# Erstelle einfaches DB-Init-Skript
|
||||
cat > "$APP_DIR/init_simple_db.py" << 'EOF'
|
||||
from app import app, db
|
||||
|
Reference in New Issue
Block a user