- Messages erreur camera/impression: texte novice ("Oups!", "Reessayez") au lieu de jargon technique
- kiosk-session.sh: lit le port depuis config.json (plus de http://localhost en dur), healthcheck /api/config, supprime git pull auto au boot
- Activer evenement: reset automatique du compteur photos
- Activer evenement: sync booth.event_id quand galerie live active
- Port par defaut backend: 80 → 8080
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
82 lines
2.5 KiB
Bash
Executable File
82 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Verrou atomique — une seule session kiosk autorisee
|
|
exec 9>/tmp/photobooth-kiosk.lock
|
|
flock -n 9 || { echo "[kiosk] Déjà en cours, abandon."; exit 0; }
|
|
|
|
PHOTOBOOTH_DIR=/home/jules/photobooth
|
|
|
|
# Port du backend (lu depuis config.json, fallback 8080)
|
|
BACKEND_PORT=$(python3 -c "
|
|
import json, sys
|
|
try:
|
|
d = json.load(open('$PHOTOBOOTH_DIR/data/config.json'))
|
|
print(d.get('serveur', {}).get('port', 8080))
|
|
except: print(8080)
|
|
" 2>/dev/null)
|
|
BACKEND_URL="http://localhost:${BACKEND_PORT}"
|
|
|
|
# Tuer tout backend orphelin d'une session precedente
|
|
pkill -f 'python.*backend.main' 2>/dev/null || true
|
|
sleep 1
|
|
|
|
xset s off
|
|
xset -dpms
|
|
xset s noblank
|
|
|
|
# Automount USB (pour la photostation)
|
|
udiskie --no-notify --no-appindicator &
|
|
|
|
# Liberer le DSLR : gvfsd-gphoto2 (GNOME) le monopolise sinon
|
|
pkill -f gvfsd-gphoto2 2>/dev/null || true
|
|
pkill -f gvfs-gphoto2-volume-monitor 2>/dev/null || true
|
|
|
|
# Backend en boucle : redemarre automatiquement s'il plante
|
|
_backend_loop() {
|
|
while true; do
|
|
while [ -f /tmp/photobooth-maintenance ]; do sleep 2; done
|
|
cd "$PHOTOBOOTH_DIR"
|
|
source .venv/bin/activate
|
|
authbind --deep python -m backend.main 2>&1 | tee -a /tmp/photobooth-backend.log
|
|
echo "[kiosk] backend terminé, redémarrage dans 3s..."
|
|
sleep 3
|
|
done
|
|
}
|
|
_backend_loop &
|
|
BACKEND_LOOP_PID=$!
|
|
|
|
# Nettoyer le backend si le kiosk est tue
|
|
trap "kill $BACKEND_LOOP_PID 2>/dev/null; pkill -f 'python.*backend.main' 2>/dev/null" EXIT
|
|
|
|
# Attendre que le backend soit pret (max 30s)
|
|
for i in $(seq 1 30); do
|
|
curl -sf "${BACKEND_URL}/api/config" > /dev/null 2>&1 && break
|
|
sleep 1
|
|
done
|
|
|
|
# Chromium en boucle : redemarre s'il plante, attend si photostation active
|
|
while true; do
|
|
while [ -f /tmp/photostation_running ]; do sleep 1; done
|
|
chromium \
|
|
--kiosk \
|
|
--noerrdialogs \
|
|
--disable-infobars \
|
|
--disable-translate \
|
|
--disable-features=TranslateUI,Translate,LockProfileCookieDatabase \
|
|
--disable-session-crashed-bubble \
|
|
--disable-component-update \
|
|
--check-for-update-interval=31536000 \
|
|
--autoplay-policy=no-user-gesture-required \
|
|
--start-fullscreen \
|
|
--user-data-dir=/home/jules/.config/chromium-kiosk \
|
|
--touch-events=enabled \
|
|
--enable-touch-drag-drop \
|
|
--force-device-scale-factor=3 \
|
|
--password-store=basic \
|
|
--lang=fr \
|
|
--remote-debugging-port=9222 \
|
|
"${BACKEND_URL}"
|
|
echo "[kiosk] Chromium terminé, redémarrage dans 2s..."
|
|
sleep 2
|
|
done
|