diff --git a/.lh/README-PI.md.json b/.lh/README-PI.md.json new file mode 100644 index 0000000..0eead43 --- /dev/null +++ b/.lh/README-PI.md.json @@ -0,0 +1,18 @@ +{ + "sourceFile": "README-PI.md", + "activeCommit": 0, + "commits": [ + { + "activePatchIndex": 0, + "patches": [ + { + "date": 1748356106564, + "content": "Index: \n===================================================================\n--- \n+++ \n" + } + ], + "date": 1748356106564, + "name": "Commit-0", + "content": "# 🍓 Adhaan Raspberry Pi Kiosk Setup\n\nComplete setup voor het draaien van de Adhaan applicatie op een Raspberry Pi in fullscreen kiosk mode.\n\n## 🚀 Snelle Installatie\n\n### 1. Raspberry Pi OS installeren\n- Download Raspberry Pi OS (Desktop versie aanbevolen)\n- Flash naar SD kaart met Raspberry Pi Imager\n- Enable SSH en WiFi in imager settings\n\n### 2. Eerste boot en SSH\n```bash\nssh pi@raspberrypi.local\n# Standaard wachtwoord: raspberry\n```\n\n### 3. Project downloaden\n```bash\ncd ~\ngit clone [jouw-repo-url] adhan\ncd adhan\n```\n\n### 4. Automatische setup uitvoeren\n```bash\nchmod +x pi-setup.sh\n./pi-setup.sh\n```\n\n### 5. Herstart\n```bash\nsudo reboot\n```\n\n## ✨ Wat gebeurt er?\n\nNa de herstart:\n1. 🐳 Docker containers starten automatisch\n2. 🖥️ X server start automatisch\n3. 🌐 Chromium opent fullscreen naar http://localhost:5090\n4. 🕌 Adhaan applicatie is zichtbaar\n\n## 🔧 " + } + ] +} \ No newline at end of file diff --git a/.lh/docker-compose-pi.yml.json b/.lh/docker-compose-pi.yml.json new file mode 100644 index 0000000..6f4b81f --- /dev/null +++ b/.lh/docker-compose-pi.yml.json @@ -0,0 +1,22 @@ +{ + "sourceFile": "docker-compose-pi.yml", + "activeCommit": 0, + "commits": [ + { + "activePatchIndex": 1, + "patches": [ + { + "date": 1748356106555, + "content": "Index: \n===================================================================\n--- \n+++ \n" + }, + { + "date": 1748356133374, + "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,1 +1,38 @@\n-\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n\\ No newline at end of file\n+services:\n+ adhan-webapp:\n+ build:\n+ context: ./adhan-webapp\n+ container_name: adhan-webapp\n+ ports:\n+ - '5090:80'\n+ restart: unless-stopped\n+ volumes:\n+ - ./adhan-webapp/settings.json:/app/settings.json\n+ - ./adhan-webapp/static:/app/static:ro\n+ - ./adhan-webapp/templates:/app/templates:ro\n+ - /etc/localtime:/etc/localtime:ro\n+ - /etc/timezone:/etc/timezone:ro\n+ environment:\n+ - FLASK_ENV=production\n+ - FLASK_DEBUG=0\n+ - PYTHONUNBUFFERED=1\n+ - TZ=Europe/Amsterdam\n+ networks:\n+ - adhan-network\n+\n+ sonos-api:\n+ container_name: sonos-api\n+ image: chrisns/docker-node-sonos-http-api\n+ network_mode: host\n+ restart: unless-stopped\n+ volumes:\n+ - ./sonos/settings.json:/app/settings.json:ro\n+ - ./sonos/presets:/app/presets:ro\n+ - ./sonos/cache:/app/cache:ro\n+ - ./sonos/clips:/app/static/clips:ro\n+\n+networks:\n+ adhan-network:\n+ driver: bridge\n+\n+version: '3.8' \n\\ No newline at end of file\n" + } + ], + "date": 1748356106555, + "name": "Commit-0", + "content": "services:\n adhan-webapp:\n build:\n context: ./adhan-webapp\n container_name: adhan-webapp\n ports:\n - '5090:80'\n restart: unless-stopped\n volumes:\n - ./adhan-webapp/settings.json:/app/settings.json\n - ./adhan-webapp/static:/app/static:ro\n - ./adhan-webapp/templates:/app/templates:ro\n - /etc/localtime:/etc/localtime:ro\n - /etc/timezone:/etc/timezone:ro\n environment:\n - FLASK_ENV=production\n - FLASK_DEBUG=0\n - PYTHONUNBUFFERED=1\n - TZ=Europe/Amsterdam\n networks:\n - adhan-network\n\n sonos-api:\n container_name: sonos-api\n image: chrisns/docker-node-sonos-http-api\n network_mode: host\n restart: unless-stopped\n volumes:\n - ./sonos/settings.json:/app/settings.json:ro\n - ./sonos/presets:/app/presets:ro\n - ./sonos/cache:/app/cache:ro\n - ./sonos/clips:/app/static/clips:ro\n\nnetworks:\n adhan-network:\n driver: bridge\n\nversion: '3.8' " + } + ] +} \ No newline at end of file diff --git a/.lh/pi-setup.sh.json b/.lh/pi-setup.sh.json new file mode 100644 index 0000000..b2aaa54 --- /dev/null +++ b/.lh/pi-setup.sh.json @@ -0,0 +1,18 @@ +{ + "sourceFile": "pi-setup.sh", + "activeCommit": 0, + "commits": [ + { + "activePatchIndex": 0, + "patches": [ + { + "date": 1748356106533, + "content": "Index: \n===================================================================\n--- \n+++ \n" + } + ], + "date": 1748356106533, + "name": "Commit-0", + "content": "#!/bin/bash\n\necho \"🍓 Adhaan Raspberry Pi Kiosk Setup\"\necho \"==================================\"\n\n# Update systeem\necho \"📦 Systeem bijwerken...\"\nsudo apt update -y\nsudo apt upgrade -y\n\n# Installeer Docker\necho \"🐳 Docker installeren...\"\ncurl -fsSL https://get.docker.com -o get-docker.sh\nsudo sh get-docker.sh\nsudo usermod -aG docker $USER\nrm get-docker.sh\n\n# Installeer Docker Compose\necho \"🔧 Docker Compose installeren...\"\nsudo apt install -y docker-compose\n\n# Installeer GUI componenten voor kiosk mode\necho \"🖥️ GUI componenten installeren...\"\nsudo apt install -y --no-install-recommends \\\n xserver-xorg \\\n x11-xserver-utils \\\n xinit \\\n openbox \\\n chromium-browser \\\n unclutter\n\n# Maak kiosk script\necho \"📝 Kiosk script aanmaken...\"\ncat > /home/$USER/kiosk.sh << 'EOF'\n#!/bin/bash\nsleep 5\n/usr/bin/chromium-browser \\\n --kiosk \\\n --start-maximized \\\n --noerrdialogs \\\n --disable-infobars \\\n --disable-session-crashed-bubble \\\n --disable-restore-session-state \\\n --disable-background-timer-throttling \\\n --disable-backgrounding-occluded-windows \\\n --disable-renderer-backgrounding \\\n --disable-features=TranslateUI \\\n --disable-ipc-flooding-protection \\\n --enable-features=OverlayScrollbar \\\n --no-first-run \\\n --fast \\\n --fast-start \\\n --disable-default-apps \\\n --disable-popup-blocking \\\n --disable-prompt-on-repost \\\n --disable-hang-monitor \\\n --disable-background-networking \\\n --aggressive-cache-discard \\\n --memory-pressure-off \\\n --max_old_space_size=100 \\\n --force-device-scale-factor=1 \\\n http://localhost:5090 &\nEOF\n\nchmod +x /home/$USER/kiosk.sh\n\n# Configureer autostart\necho \"⚙️ Autostart configureren...\"\nsudo mkdir -p /etc/xdg/openbox\ncat > /tmp/autostart << 'EOF'\n# Schakel power management uit\nxset -dpms\nxset s noblank\nxset s off\n\n# Verberg cursor na 3 seconden\nunclutter -idle 3 -root &\n\n# Verwijder crash berichten\nsed -i 's/\"exited_cleanly\":false/\"exited_cleanly\":true/' ~/.config/chromium/'Local State' 2>/dev/null || true\nsed -i 's/\"exited_cleanly\":false/\"exited_cleanly\":true/; s/\"exit_type\":\"[^\"]\\+\"/\"exit_type\":\"Normal\"/' ~/.config/chromium/Default/Preferences 2>/dev/null || true\n\n# Start kiosk\n/home/USER_PLACEHOLDER/kiosk.sh\nEOF\n\nsed \"s/USER_PLACEHOLDER/$USER/g\" /tmp/autostart | sudo tee /etc/xdg/openbox/autostart > /dev/null\n\n# Configureer automatische X start\necho \"🚀 Automatische X start configureren...\"\nif ! grep -q \"startx\" ~/.bash_profile 2>/dev/null; then\n echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor' >> ~/.bash_profile\nfi\n\n# Configureer automatische login\necho \"👤 Automatische login configureren...\"\nsudo raspi-config nonint do_boot_behaviour B4\n\n# Maak systemd service voor Docker\necho \"🔄 Docker service configureren...\"\ncat > /tmp/adhan-docker.service << 'EOF'\n[Unit]\nDescription=Adhaan Docker Services\nRequires=docker.service\nAfter=docker.service\n\n[Service]\nType=oneshot\nRemainAfterExit=yes\nWorkingDirectory=/home/USER_PLACEHOLDER/adhan\nExecStart=/usr/bin/docker-compose -f docker-compose-pi.yml up -d\nExecStop=/usr/bin/docker-compose -f docker-compose-pi.yml down\nTimeoutStartSec=0\n\n[Install]\nWantedBy=multi-user.target\nEOF\n\nsed \"s/USER_PLACEHOLDER/$USER/g\" /tmp/adhan-docker.service | sudo tee /etc/systemd/system/adhan-docker.service > /dev/null\nsudo systemctl enable adhan-docker.service\n\necho \"✅ Setup voltooid!\"\necho \"\"\necho \"📋 Volgende stappen:\"\necho \"1. Herstart de Pi: sudo reboot\"\necho \"2. De Pi start automatisch in kiosk mode\"\necho \"3. Docker containers starten automatisch\"\necho \"4. Webpagina opent automatisch op http://localhost:5090\"\necho \"\"\necho \"🔧 Handmatige bediening:\"\necho \"- Alt+F4: Sluit browser\"\necho \"- Ctrl+Alt+T: Open terminal\"\necho \"- sudo systemctl status adhan-docker: Check Docker status\" " + } + ] +} \ No newline at end of file diff --git a/README-PI.md b/README-PI.md new file mode 100644 index 0000000..3043dbe --- /dev/null +++ b/README-PI.md @@ -0,0 +1,44 @@ +# 🍓 Adhaan Raspberry Pi Kiosk Setup + +Complete setup voor het draaien van de Adhaan applicatie op een Raspberry Pi in fullscreen kiosk mode. + +## 🚀 Snelle Installatie + +### 1. Raspberry Pi OS installeren +- Download Raspberry Pi OS (Desktop versie aanbevolen) +- Flash naar SD kaart met Raspberry Pi Imager +- Enable SSH en WiFi in imager settings + +### 2. Eerste boot en SSH +```bash +ssh pi@raspberrypi.local +# Standaard wachtwoord: raspberry +``` + +### 3. Project downloaden +```bash +cd ~ +git clone [jouw-repo-url] adhan +cd adhan +``` + +### 4. Automatische setup uitvoeren +```bash +chmod +x pi-setup.sh +./pi-setup.sh +``` + +### 5. Herstart +```bash +sudo reboot +``` + +## ✨ Wat gebeurt er? + +Na de herstart: +1. 🐳 Docker containers starten automatisch +2. 🖥️ X server start automatisch +3. 🌐 Chromium opent fullscreen naar http://localhost:5090 +4. 🕌 Adhaan applicatie is zichtbaar + +## 🔧 \ No newline at end of file diff --git a/adhan-webapp/settings.json b/adhan-webapp/settings.json index 575a11b..f5b14ca 100644 --- a/adhan-webapp/settings.json +++ b/adhan-webapp/settings.json @@ -1,6 +1,6 @@ { "volume_day": 10, - "volume_night": 4, + "volume_night": 5, "night_start": "23:50", "day_start": "07:00", "fajr_offset": 30, diff --git a/docker-compose-pi.yml b/docker-compose-pi.yml new file mode 100644 index 0000000..cded1d1 --- /dev/null +++ b/docker-compose-pi.yml @@ -0,0 +1,38 @@ +services: + adhan-webapp: + build: + context: ./adhan-webapp + container_name: adhan-webapp + ports: + - '5090:80' + restart: unless-stopped + volumes: + - ./adhan-webapp/settings.json:/app/settings.json + - ./adhan-webapp/static:/app/static:ro + - ./adhan-webapp/templates:/app/templates:ro + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro + environment: + - FLASK_ENV=production + - FLASK_DEBUG=0 + - PYTHONUNBUFFERED=1 + - TZ=Europe/Amsterdam + networks: + - adhan-network + + sonos-api: + container_name: sonos-api + image: chrisns/docker-node-sonos-http-api + network_mode: host + restart: unless-stopped + volumes: + - ./sonos/settings.json:/app/settings.json:ro + - ./sonos/presets:/app/presets:ro + - ./sonos/cache:/app/cache:ro + - ./sonos/clips:/app/static/clips:ro + +networks: + adhan-network: + driver: bridge + +version: '3.8' \ No newline at end of file diff --git a/pi-setup.sh b/pi-setup.sh new file mode 100644 index 0000000..e3de1f4 --- /dev/null +++ b/pi-setup.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +echo "🍓 Adhaan Raspberry Pi Kiosk Setup" +echo "==================================" + +# Update systeem +echo "📦 Systeem bijwerken..." +sudo apt update -y +sudo apt upgrade -y + +# Installeer Docker +echo "🐳 Docker installeren..." +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh +sudo usermod -aG docker $USER +rm get-docker.sh + +# Installeer Docker Compose +echo "🔧 Docker Compose installeren..." +sudo apt install -y docker-compose + +# Installeer GUI componenten voor kiosk mode +echo "🖥️ GUI componenten installeren..." +sudo apt install -y --no-install-recommends \ + xserver-xorg \ + x11-xserver-utils \ + xinit \ + openbox \ + chromium-browser \ + unclutter + +# Maak kiosk script +echo "📝 Kiosk script aanmaken..." +cat > /home/$USER/kiosk.sh << 'EOF' +#!/bin/bash +sleep 5 +/usr/bin/chromium-browser \ + --kiosk \ + --start-maximized \ + --noerrdialogs \ + --disable-infobars \ + --disable-session-crashed-bubble \ + --disable-restore-session-state \ + --disable-background-timer-throttling \ + --disable-backgrounding-occluded-windows \ + --disable-renderer-backgrounding \ + --disable-features=TranslateUI \ + --disable-ipc-flooding-protection \ + --enable-features=OverlayScrollbar \ + --no-first-run \ + --fast \ + --fast-start \ + --disable-default-apps \ + --disable-popup-blocking \ + --disable-prompt-on-repost \ + --disable-hang-monitor \ + --disable-background-networking \ + --aggressive-cache-discard \ + --memory-pressure-off \ + --max_old_space_size=100 \ + --force-device-scale-factor=1 \ + http://localhost:5090 & +EOF + +chmod +x /home/$USER/kiosk.sh + +# Configureer autostart +echo "⚙️ Autostart configureren..." +sudo mkdir -p /etc/xdg/openbox +cat > /tmp/autostart << 'EOF' +# Schakel power management uit +xset -dpms +xset s noblank +xset s off + +# Verberg cursor na 3 seconden +unclutter -idle 3 -root & + +# Verwijder crash berichten +sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State' 2>/dev/null || true +sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences 2>/dev/null || true + +# Start kiosk +/home/USER_PLACEHOLDER/kiosk.sh +EOF + +sed "s/USER_PLACEHOLDER/$USER/g" /tmp/autostart | sudo tee /etc/xdg/openbox/autostart > /dev/null + +# Configureer automatische X start +echo "🚀 Automatische X start configureren..." +if ! grep -q "startx" ~/.bash_profile 2>/dev/null; then + echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor' >> ~/.bash_profile +fi + +# Configureer automatische login +echo "👤 Automatische login configureren..." +sudo raspi-config nonint do_boot_behaviour B4 + +# Maak systemd service voor Docker +echo "🔄 Docker service configureren..." +cat > /tmp/adhan-docker.service << 'EOF' +[Unit] +Description=Adhaan Docker Services +Requires=docker.service +After=docker.service + +[Service] +Type=oneshot +RemainAfterExit=yes +WorkingDirectory=/home/USER_PLACEHOLDER/adhan +ExecStart=/usr/bin/docker-compose -f docker-compose-pi.yml up -d +ExecStop=/usr/bin/docker-compose -f docker-compose-pi.yml down +TimeoutStartSec=0 + +[Install] +WantedBy=multi-user.target +EOF + +sed "s/USER_PLACEHOLDER/$USER/g" /tmp/adhan-docker.service | sudo tee /etc/systemd/system/adhan-docker.service > /dev/null +sudo systemctl enable adhan-docker.service + +echo "✅ Setup voltooid!" +echo "" +echo "📋 Volgende stappen:" +echo "1. Herstart de Pi: sudo reboot" +echo "2. De Pi start automatisch in kiosk mode" +echo "3. Docker containers starten automatisch" +echo "4. Webpagina opent automatisch op http://localhost:5090" +echo "" +echo "🔧 Handmatige bediening:" +echo "- Alt+F4: Sluit browser" +echo "- Ctrl+Alt+T: Open terminal" +echo "- sudo systemctl status adhan-docker: Check Docker status" \ No newline at end of file