Last active
January 21, 2026 13:45
-
-
Save adricasti/4f89eb3b70e932ce35f32a2e9a5b8e58 to your computer and use it in GitHub Desktop.
Script to install a Chromium Kiosk in Alpine Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # 1. Enable Community Repositories automatically | |
| # This searches for lines containing '/community' and removes the '#' prefix | |
| sed -i 's/#http/http/g' /etc/apk/repositories | |
| # 2. Add required packages | |
| # mesa-egl and mesa-gbm are included automatically by mesa-dri-gallium and mesa-va-gallium | |
| apk update | |
| apk add open-vm-tools sway swaybg mesa-dri-gallium mesa-va-gallium \ | |
| dbus seatd pcsc-lite ccid eudev chromium | |
| # 3. Enable and Start Services | |
| rc-update add open-vm-tools default | |
| rc-update add seatd default | |
| rc-update add pcscd default | |
| rc-update add udev sysinit | |
| rc-update add udev-trigger sysinit | |
| rc-service open-vm-tools start | |
| rc-service seatd start | |
| rc-service pcscd start | |
| rc-service udev start | |
| rc-service udev-trigger start | |
| # 4. Create kiosk user | |
| adduser -D chromeuser | |
| addgroup chromeuser video | |
| addgroup chromeuser input | |
| addgroup chromeuser seat | |
| # 5. Create Sway Config Directory | |
| mkdir -p /home/chromeuser/.config/sway | |
| # 6. Create the Sway Config file | |
| cat <<EOF > /home/chromeuser/.config/sway/config | |
| # Kiosk configuration | |
| output * bg #000000 solid_color | |
| input "type:keyboard" { | |
| xkb_layout us | |
| xkb_variant dvorak | |
| } | |
| # Auto-start Chromium in Wayland mode | |
| # Added --no-first-run and --kiosk for a cleaner kiosk experience | |
| exec_always chromium-browser --enable-features=UseOzonePlatform --ozone-platform=wayland --no-first-run --kiosk | |
| # Emergency Exit (Mod4 is Command/Win key) | |
| bindsym Mod4+Shift+e exec swaymsg exit | |
| EOF | |
| # 7. Create the .profile for Environment and Auto-Start | |
| cat <<'EOF' > /home/chromeuser/.profile | |
| # Setup XDG_RUNTIME_DIR | |
| export XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime | |
| if [ ! -d "$XDG_RUNTIME_DIR" ]; then | |
| mkdir -pm 0700 "$XDG_RUNTIME_DIR" | |
| fi | |
| # Environment Variables for VMware/Sway Stability | |
| export LIBSEAT_BACKEND=seatd | |
| export WLR_NO_HARDWARE_CURSORS=1 | |
| # Use Pixman (software rendering) to bypass vmwgfx driver issues on M2 | |
| export WLR_RENDERER=pixman | |
| # Auto-start Sway on login (only if on TTY1) | |
| if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then | |
| exec dbus-run-session sway | |
| fi | |
| EOF | |
| # 8. Set correct permissions | |
| chown -R chromeuser:chromeuser /home/chromeuser/ | |
| chmod +x /home/chromeuser/.profile | |
| echo "Setup complete. Log in as 'chromeuser' on TTY1 to start the kiosk." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment