#!/usr/bin/env bash # preview-plymouth.sh — fast local preview of the 'fleet' boot splash WITHOUT # building/booting the full diskless image. The splash is just plymouthd + the # theme + status tokens, so it runs on any Linux box with plymouth installed # (root), driven by the same `plymouth update --status=` tokens the dracut hooks # emit (dot1x-macsec-up.sh / nvmf-connect.sh). # # sudo bash scripts/preview-plymouth.sh [secure|test] # # Seeing it: # - Windowed: needs the X11 renderer (Debian/Ubuntu: `apt install plymouth-x11`, # run inside an X session). Fedora/RHEL often don't package it. # - No X11 renderer: switch to a spare VT (Ctrl+Alt+F3), run there, watch, # Ctrl+Alt+F1 back — plymouthd grabs DRM on that VT. # - Headless/CI screenshot: Xvfb + x11 renderer + a grab tool. # # Iterate: edit files/plymouth/themes/fleet/fleet.script, re-run this. Seconds, # not a 30-min image build. (On an already-booted diskless host the root overlay # is writable, so you can scp the theme to /usr/share/plymouth/themes/fleet and # run this there for a real distro/font/plugin stack.) set -euo pipefail [ "$(id -u)" -eq 0 ] || { echo "run as root (plymouthd needs it)" >&2; exit 1; } mode=${1:-secure} theme_src=${THEME_SRC:-files/plymouth/themes/fleet} dest=/usr/share/plymouth/themes/fleet command -v plymouthd >/dev/null 2>&1 || { echo "ERROR: plymouthd not found — install plymouth, plymouth-scripts," >&2 echo " plymouth-plugin-label, and the script plugin first." >&2 exit 1 } [ -f "$theme_src/fleet.script" ] || { echo "ERROR: $theme_src/fleet.script not found (run from the repo root, or set THEME_SRC)." >&2 exit 1 } echo "==> installing theme: $theme_src -> $dest" mkdir -p "$dest" cp -a "$theme_src"/. "$dest"/ plymouth-set-default-theme fleet 2>/dev/null || \ echo "WARNING: plymouth-set-default-theme failed (plymouth-scripts missing?) — continuing" >&2 if [ ! -e /usr/lib64/plymouth/script.so ] && [ ! -e /usr/lib/plymouth/script.so ]; then echo "WARNING: plymouth script plugin (script.so) not found — the theme will not render." >&2 fi echo "==> starting plymouthd (debug log: /tmp/plymouth-preview.log)" plymouth quit 2>/dev/null || true plymouthd --no-daemon --debug --debug-file=/tmp/plymouth-preview.log & ply_pid=$! trap 'plymouth quit 2>/dev/null || true; kill "$ply_pid" 2>/dev/null || true' EXIT sleep 1 plymouth show-splash sleep 1 emit() { echo " --status=$1" plymouth update --status="$1" || true sleep "${2:-1.2}" } echo "==> driving the '$mode' handshake sequence" if [ "$mode" = test ]; then emit mode-test 0.6 emit net-active; emit net-done emit nvme-active; emit nvme-done 1.5 else emit tpm-active; emit tpm-done emit dot1x-active 1.6; emit dot1x-done emit macsec-active; emit macsec-done emit net-active 1.6; emit net-done emit nvme-active 1.6; emit nvme-done 2 fi echo "==> sequence complete; press Enter to quit the splash" read -r _ || true