-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwait-and-launch.sh
More file actions
executable file
·62 lines (53 loc) · 1.75 KB
/
wait-and-launch.sh
File metadata and controls
executable file
·62 lines (53 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# =============================================================================
# wait-and-launch.sh — Wait for HTTP server, then launch Chromium in kiosk mode
#
# Called by desktop autostart. Loops until the app is ready, then opens
# Chromium with GPU-optimised flags for Raspberry Pi 3.
# =============================================================================
set -euo pipefail
URL="${1:-http://localhost:3000}"
LOG="/tmp/kiosk-launch.log"
echo "[kiosk] Waiting for ${URL} ..." | tee "${LOG}"
# Wait up to 60s for the HTTP server
for i in $(seq 1 60); do
if curl -sf -o /dev/null "${URL}" 2>/dev/null; then
echo "[kiosk] Server ready after ${i}s" | tee -a "${LOG}"
break
fi
sleep 1
done
# Hide cursor
unclutter -idle 0.5 -root &
# Determine Chromium binary
if command -v chromium &>/dev/null; then
CHROME=chromium
elif command -v chromium-browser &>/dev/null; then
CHROME=chromium-browser
else
echo "[kiosk] ERROR: No Chromium found" | tee -a "${LOG}"
exit 1
fi
echo "[kiosk] Launching ${CHROME} → ${URL}" | tee -a "${LOG}"
# Launch with auto-restart on crash
while true; do
"${CHROME}" \
--kiosk \
--enable-gpu-rasterization \
--enable-zero-copy \
--ignore-gpu-blocklist \
--num-raster-threads=2 \
--use-gl=egl \
--disable-smooth-scrolling \
--disable-low-res-tiling \
--disable-dev-shm-usage \
--noerrdialogs \
--no-first-run \
--disable-infobars \
--password-store=basic \
--disable-features=TranslateUI \
--check-for-update-interval=31536000 \
"${URL}" >> "${LOG}" 2>&1
echo "[kiosk] Chromium exited ($?), restarting in 3s..." | tee -a "${LOG}"
sleep 3
done