#!/bin/bash
# =========================================================================
# Script d'installation automatique Borne Salle de Réunion (Raspberry Pi)
# =========================================================================
KIOSK_URL="https://kpi-rh.com/salles.php?kiosk=1&room_id=1"

echo "1/4 - Installation des outils d'affichage plein écran et anti-veille..."
sudo apt-get update && sudo apt-get install -y unclutter xdotool

echo "2/4 - Création du script de lancement Kiosque..."
cat << 'EOF' > ~/start_kiosk.sh
#!/bin/bash
xset s noblank
xset s off
xset -dpms
unclutter -idle 3 -root &
BROWSER_BIN=$(command -v chromium-browser || command -v chromium)
$BROWSER_BIN --noerrdialogs --disable-infobars --kiosk "https://kpi-rh.com/salles.php?kiosk=1&room_id=1" --check-for-update-interval=31536000
EOF
chmod +x ~/start_kiosk.sh

echo "3/4 - Configuration du démarrage automatique..."
mkdir -p ~/.config/autostart
cat << EOF > ~/.config/autostart/kollab-kiosk.desktop
[Desktop Entry]
Type=Application
Name=Kollab Salle de Reunion
Exec=/home/$USER/start_kiosk.sh
X-GNOME-Autostart-enabled=true
EOF

echo "4/4 - Installation terminée ! Redémarrez avec : sudo reboot"
