preseed/post_install.sh
2025-12-18 21:20:35 +01:00

110 lines
No EOL
2.7 KiB
Bash

printf "[daemon]\nAutomaticLoginEnable=true\nAutomaticLogin=kiosk\n\n[security]\n\n[xdmcp]\n\n[chooser]\n\n[debug]\n" > /etc/gdm3/daemon.conf
# Firefox policy
mkdir -p /usr/lib/firefox-esr/distribution
tee /usr/lib/firefox-esr/distribution/policies.json > /dev/null <<'EOF'
{
"policies": {
"DisableDeveloperTools": true,
"BlockAboutAddons": true,
"BlockAboutConfig": true,
"BlockAboutProfiles": true,
"BlockAboutSupport": true,
"DisableFirefoxAccounts": true,
"DisablePrivateBrowsing": true,
"DisableProfileImport": true,
"DisableProfileRefresh": true,
"DisableSafeMode": true,
"DisablePocket": true,
"DisableFirefoxScreenshots": true,
"DisableSetDesktopBackground": true,
"Homepage": {
"URL": "https://mahn.ke",
"Locked": true
},
"NewTabPage": {
"Enabled": false
},
"DownloadDirectory": {
"Path": "C:\\KioskDownloads",
"Locked": true
},
"PromptForDownloadLocation": false,
"StartDownloadsInTempDirectory": false,
"DisableAppUpdate": true,
"Permissions": {
"Camera": "deny",
"Microphone": "deny",
"Location": "deny",
"Notifications": "deny"
},
"ShowHomeButton": false,
"DisplayMenuBar": false,
"DisplayBookmarksToolbar": false,
"policies": {
"UserMessaging": {
"ExtensionRecommendations": false,
"FeatureRecommendations": false,
"UrlbarInterventions": false,
"SkipOnboarding": false,
"MoreFromMozilla": false,
"FirefoxLabs": false,
"Locked": false
}
}
}
}
EOF
# Bash autostart of sway
tee /home/kiosk/.bash_profile > /dev/null <<'EOF'
if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway
fi
EOF
# Sway config
mkdir -p /home/kiosk/.config/sway/
tee /home/kiosk/.config/sway/config > /dev/null <<'EOF'
input type:pointer {
events disabled
}
input type:keyboard {
events disabled
}
input type:touch {
events enabled
}
input * xkb_layout de
## This may not be needed if there is a systemd unit
# exec_always firefox --wayland --kiosk
EOF
# Systemd unit
mkdir -p /home/kiosk/.config/systemd/user/
tee /home/kiosk/.config/systemd/user/firefox-kiosk.service > /dev/null <<'EOF'
service
[Unit]
Description=Firefox im Kiosk-Mode
[Service]
Type=simple
TimeoutStartSec=0
ExecStart=/usr/bin/firefox --kiosk
Environment=DISPLAY=:0
Restart=always
[Install]
WantedBy=default.target
EOF
mkdir -p /home/kiosk/.config/systemd/user/default.target.wants/
ln -s /home/kiosk/.config/systemd/user/firefox-kiosk.service /home/kiosk/.config/systemd/user/default.target.wants/firefox-kiosk.service
chown -R kiosk:kiosk /home/kiosk/.config