61 lines
1.9 KiB
Bash
61 lines
1.9 KiB
Bash
#!/bin/sh
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Enter kiosk URL (e.g., https://dashboard.company.com):"
|
|
read -r KIOSK_URL
|
|
else
|
|
KIOSK_URL="$1"
|
|
fi
|
|
|
|
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 xf86-input-libinput mesa-dri-gallium
|
|
|
|
echo "Creating .xinitrc for kiosk mode"
|
|
cat > /root/.xinitrc << EOF
|
|
#!/bin/sh
|
|
|
|
xset -dpms
|
|
xset s off
|
|
xset s noblank
|
|
|
|
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 > /root/.profile << 'EOF'
|
|
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!"
|
|
echo "URL configured: $KIOSK_URL"
|
|
echo "Reboot to start kiosk mode: reboot"
|
|
|