diff --git a/config/plymouth/voxip-kiosk/logo.png b/config/plymouth/voxip-kiosk/logo.png new file mode 100644 index 0000000..e1d332c Binary files /dev/null and b/config/plymouth/voxip-kiosk/logo.png differ diff --git a/config/plymouth/voxip-kiosk/voxip-kiosk.plymouth b/config/plymouth/voxip-kiosk/voxip-kiosk.plymouth new file mode 100644 index 0000000..0bd662d --- /dev/null +++ b/config/plymouth/voxip-kiosk/voxip-kiosk.plymouth @@ -0,0 +1,8 @@ +[Plymouth Theme] +Name=voxip-kiosk +Description=VoxIP Kiosk boot splash (logo on white) +ModuleName=script + +[script] +ImageDir=/usr/share/plymouth/themes/voxip-kiosk +ScriptFile=/usr/share/plymouth/themes/voxip-kiosk/voxip-kiosk.script diff --git a/config/plymouth/voxip-kiosk/voxip-kiosk.script b/config/plymouth/voxip-kiosk/voxip-kiosk.script new file mode 100644 index 0000000..751dc3a --- /dev/null +++ b/config/plymouth/voxip-kiosk/voxip-kiosk.script @@ -0,0 +1,12 @@ +# VoxIP Kiosk boot splash: logo.png centred on white, at most half the screen. +# Replace logo.png (any size, PNG with transparency) for a different logo. +Window.SetBackgroundTopColor(1, 1, 1); +Window.SetBackgroundBottomColor(1, 1, 1); + +logo = Image("logo.png"); +scale = Math.Min(Window.GetWidth() * 0.5 / logo.GetWidth(), Window.GetHeight() * 0.5 / logo.GetHeight()); +if (scale > 1) scale = 1; +logo = logo.Scale(logo.GetWidth() * scale, logo.GetHeight() * scale); + +sprite = Sprite(logo); +sprite.SetPosition((Window.GetWidth() - logo.GetWidth()) / 2, (Window.GetHeight() - logo.GetHeight()) / 2, 0); diff --git a/install.sh b/install.sh index 9531376..050b1b1 100755 --- a/install.sh +++ b/install.sh @@ -95,7 +95,7 @@ pkg_available() { apt-cache policy "$1" 2>/dev/null | grep -q 'Candidate: [0-9]' "$CHROMIUM" xserver-xorg-core xserver-xorg-input-libinput xserver-xorg-legacy x11-xserver-utils xauth fonts-dejavu-core fonts-noto-color-emoji python3 python3-flask python3-argon2 python3-websocket gunicorn - network-manager avahi-daemon iw rfkill iproute2 openssl logrotate sudo kbd + network-manager avahi-daemon iw rfkill iproute2 openssl logrotate sudo kbd plymouth ) for opt in systemd-zram-generator libraspberrypi-bin raspi-utils-core; do if pkg_available "$opt"; then PKGS+=("$opt"); fi @@ -235,14 +235,45 @@ if [[ -f /usr/share/systemd/tmp.mount && ! -e /etc/systemd/system/tmp.mount ]] & systemctl enable tmp.mount 2>/dev/null || true fi -# No console blanking (the kiosk runs on vt7, but keep the console awake too). +# Kernel command line: no console blanking (the kiosk runs on vt7, but keep the console +# awake too), and a quiet boot behind the splash: no boot text, Raspberry logos or cursor. +add_cmdline() { # add "key" or "key=value" unless the key is already present + local key="${2%%=*}" + grep -qE "(^| )${key//./\\.}(=[^ ]*)?( |\$)" "$1" || sed -i "1 s/\$/ $2/" "$1" +} for cmdline in /boot/firmware/cmdline.txt /boot/cmdline.txt; do if [[ -f $cmdline ]]; then - grep -q 'consoleblank=' "$cmdline" || sed -i '1 s/$/ consoleblank=0/' "$cmdline" + for opt in consoleblank=0 quiet splash plymouth.ignore-serial-consoles logo.nologo vt.global_cursor_default=0; do + add_cmdline "$cmdline" "$opt" + done + config_txt="$(dirname "$cmdline")/config.txt" + # No rainbow square from the firmware. [all] in case the file ends in a model section. + if [[ -f $config_txt ]] && ! grep -q '^disable_splash=' "$config_txt"; then + printf '\n[all]\ndisable_splash=1\n' >> "$config_txt" + fi break fi done +# Boot splash: logo on white (config/plymouth). Rebuilding the initramfs takes a while +# on a Pi 3, so only when the theme changed. +SPLASH_DIR=/usr/share/plymouth/themes/voxip-kiosk +install -d -m 0755 "$SPLASH_DIR" +install -m 0644 "$SRC"/config/plymouth/voxip-kiosk/* "$SPLASH_DIR/" +if [[ ! -f /var/lib/voxip-kiosk/previous-plymouth-theme ]]; then + plymouth-set-default-theme > /var/lib/voxip-kiosk/previous-plymouth-theme 2>/dev/null || true +fi +SPLASH_SUM="$(cat "$SPLASH_DIR"/* | sha256sum | cut -d' ' -f1)" +if [[ "$(plymouth-set-default-theme 2>/dev/null)" != voxip-kiosk || "$(cat /var/lib/voxip-kiosk/splash.sha256 2>/dev/null)" != "$SPLASH_SUM" ]]; then + say "Opstartscherm instellen (initramfs bijwerken, dit duurt even)" + plymouth-set-default-theme voxip-kiosk + if update-initramfs -u -k all >/dev/null 2>&1; then + echo "$SPLASH_SUM" > /var/lib/voxip-kiosk/splash.sha256 + else + warn "initramfs bijwerken mislukt; het opstartscherm verschijnt mogelijk pas later tijdens het opstarten." + fi +fi + # A desktop display manager would fight over vt7 and display :0 (Pi OS Desktop images). # uninstall.sh re-enables the ones recorded here. for dm in lightdm.service gdm3.service sddm.service; do diff --git a/uninstall.sh b/uninstall.sh index 5c48497..80fbf70 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -20,6 +20,7 @@ UNITS=(voxip-kiosk-healthcheck.timer voxip-kiosk-healthcheck.service voxip-kiosk voxip-network-guard.service voxip-boot-import.service) PREVIOUS_TARGET="$(cat /var/lib/voxip-kiosk/previous-default-target 2>/dev/null || true)" +PREVIOUS_SPLASH="$(cat /var/lib/voxip-kiosk/previous-plymouth-theme 2>/dev/null || true)" mapfile -t DISABLED_DMS < <(cat /var/lib/voxip-kiosk/disabled-display-managers 2>/dev/null) echo "==> Services stoppen en verwijderen" @@ -44,6 +45,11 @@ if [[ -f /etc/X11/Xwrapper.config.voxip-orig ]]; then else rm -f /etc/X11/Xwrapper.config fi +if [[ -d /usr/share/plymouth/themes/voxip-kiosk ]]; then + echo "==> Opstartscherm terugzetten (${PREVIOUS_SPLASH:-text})" + rm -rf /usr/share/plymouth/themes/voxip-kiosk + plymouth-set-default-theme -R "${PREVIOUS_SPLASH:-text}" >/dev/null 2>&1 || true +fi if [[ -f /etc/systemd/system/display-kiosk.service.voxip-disabled ]]; then echo " (de eerdere InfoFlow-kioskservice staat nog als display-kiosk.service.voxip-disabled)" fi