#!/bin/bash # Verrou : une seule instance autorisée LOCK=/tmp/photobooth-kiosk.lock if [ -f "$LOCK" ] && kill -0 "$(cat $LOCK)" 2>/dev/null; then echo "[kiosk] Déjà en cours (pid $(cat $LOCK)), abandon." exit 0 fi echo $$ > "$LOCK" trap "rm -f $LOCK" EXIT xset s off xset -dpms xset s noblank # Automount USB (pour la photostation) udiskie --no-notify --no-appindicator & # Libérer 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 sleep 1 # Backend en boucle : redémarre automatiquement s'il plante _backend_loop() { while true; do cd /home/jules/photobooth # Mise à jour automatique depuis Gitea git pull --ff-only 2>&1 | logger -t photobooth-git 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 & # Attendre que le backend soit prêt (max 15s) for i in $(seq 1 15); do curl -sf http://localhost/ > /dev/null 2>&1 && break sleep 1 done # Chromium en boucle : redémarre s'il plante, attend si photostation active while true; do while [ -f /tmp/photostation_running ]; do sleep 1; done chromium \ --kiosk \ --remote-debugging-port=9222 \ --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 \ http://localhost echo "[kiosk] Chromium terminé, redémarrage dans 2s..." sleep 2 done