diff --git a/kiosk.sh b/kiosk.sh new file mode 100644 index 0000000..c426793 --- /dev/null +++ b/kiosk.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +KIOSK_URL="${1:-https://example.com}" + +echo "Setting up Alpine Linux Kiosk..." +echo "Kiosk URL: $KIOSK_URL" + +if ! grep -q "community" /etc/apk/repositories; then + echo "http://dl-cdn.alpinelinux.org/alpine/v3.22/community" >> /etc/apk/repositories + apk update +fi + +echo "Installing kiosk packages..." +apk add chromium xorg-server xinit openbox font-noto unclutter xf86-input-libinput mesa-dri-gallium + +echo "Creating .xinitrc for kiosk mode" +cat << EOF > /root/.xinitrc +#!/bin/sh + +xset -dpms +xset s off +xset s noblank + +unclutter -idle 1 & + +mkdir -p /root/.config/chromium/Default +sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /root/.config/chromium/Default/Preferences 2>/dev/null || true +sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /root/.config/chromium/Default/Preferences 2>/dev/null || true + +while true; do + /usr/bin/chromium-browser $KIOSK_URL \\ + --window-size=1920,1080 \\ + --window-position=0,0 \\ + --start-fullscreen \\ + --kiosk \\ + --incognito \\ + --noerrdialogs \\ + --disable-translate \\ + --no-first-run \\ + --fast \\ + --fast-start \\ + --disable-infobars \\ + --disable-features=TranslateUI \\ + --enable-features=OverlayScrollbars \\ + --disk-cache-dir=/dev/null \\ + --overscroll-history-navigation=0 \\ + --disable-pinch \\ + --no-sandbox \\ + --disable-dev-shm-usage \\ + --disable-sync \\ + --disable-signin-frame-redirect + + echo "Browser crashed, restarting in 5 seconds..." + sleep 5 +done +EOF + +chmod +x /root/.xinitrc + +echo "Setting up auto-start X11 on boot" +cat << 'EOF' > /root/.profile +if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then + exec startx +fi +EOF + +if ! grep -q "getty -n -l /bin/sh" /etc/inittab; then + sed -i 's/^tty1:/#&/' /etc/inittab + echo 'tty1::respawn:/sbin/getty -n -l /bin/sh 38400 tty1' >> /etc/inittab +fi + +echo "kiosk" > /etc/hostname + +echo "" +echo "Kiosk setup complete! (Script is safe to re-run)" +echo "URL configured: $KIOSK_URL" +echo "Reboot to start kiosk mode: reboot" +