mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 10:51:36 -04:00
Polishing first-boot UX: better splash placement + post-bootstrap notification.
Splash: Shifted the logo + text block up by half a logo-height. GRUB's menu renders centred over the splash; the previous placement put the icon directly behind the menu entries. First-boot summary: wrolpi-bootstrap.sh now accumulates a short list of notable actions (partition created, Postgres cluster set up, DB initialised) and writes them to /tmp/wrolpi-firstboot-summary.txt. A new XDG autostart (wrolpi-firstboot-notify) reads that file once XFCE comes up and shows a zenity dialog telling the user what just happened — answering the "wait, what did this thing just do to my USB drive?" question. Subsequent boots where the bootstrap is a no-op write no summary file, so the dialog only appears the boot it actually matters. /tmp is tmpfs, so the file is also naturally per-boot. Adds zenity to the package list (not pulled by --apt-recommends false). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0dc7f60a37
commit
217ec2da70
6 changed files with 60 additions and 0 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 58 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
|
@ -0,0 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=WROLPi First-Boot Notification
|
||||
Comment=Show a summary of what WROLPi bootstrap did on first boot
|
||||
Exec=/usr/local/bin/wrolpi-firstboot-notify
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
# Surface the first-boot bootstrap summary as a zenity dialog once the
|
||||
# XFCE session is up.
|
||||
#
|
||||
# wrolpi-bootstrap.service writes /tmp/wrolpi-firstboot-summary.txt when
|
||||
# it does notable work (creates the persistence partition, initialises
|
||||
# the Postgres cluster, runs the DB schema migration). This script —
|
||||
# autostarted via /etc/xdg/autostart/wrolpi-firstboot-notify.desktop —
|
||||
# reads it, shows the contents to the user, and removes the file.
|
||||
#
|
||||
# /tmp is tmpfs, so the file is naturally per-boot. Uneventful boots
|
||||
# (where bootstrap was a no-op) leave nothing to display.
|
||||
|
||||
F=/tmp/wrolpi-firstboot-summary.txt
|
||||
[ -f "$F" ] || exit 0
|
||||
|
||||
if command -v zenity >/dev/null 2>&1; then
|
||||
zenity --info --width=520 --title="Welcome to WROLPi" --text="$(cat "$F")"
|
||||
elif command -v notify-send >/dev/null 2>&1; then
|
||||
notify-send -t 30000 "WROLPi setup complete" "$(cat "$F")"
|
||||
fi
|
||||
|
||||
rm -f "$F"
|
||||
|
|
@ -36,6 +36,17 @@ progress() {
|
|||
log "$1"
|
||||
}
|
||||
|
||||
# Accumulate human-readable notes about anything non-trivial we did this
|
||||
# boot. If anything ends up in $SUMMARY by end-of-run we write it to a
|
||||
# file under /tmp/ that the wrolpi user's XFCE autostart picks up to show
|
||||
# a zenity dialog (see /usr/local/bin/wrolpi-firstboot-notify). /tmp is
|
||||
# tmpfs so the file is naturally per-boot; subsequent uneventful boots
|
||||
# show no dialog.
|
||||
SUMMARY=""
|
||||
SUMMARY_FILE=/tmp/wrolpi-firstboot-summary.txt
|
||||
note_action() { SUMMARY="${SUMMARY}- $1
|
||||
"; }
|
||||
|
||||
progress "Preparing WROLPi..."
|
||||
|
||||
# --- Detect Live vs Installed -------------------------------------------
|
||||
|
|
@ -105,6 +116,8 @@ if [ -n "$BOOT_DRIVE" ]; then
|
|||
fi
|
||||
progress "Formatting $PERSIST_PART as ext4..."
|
||||
mkfs.ext4 -L persistence -F "$PERSIST_PART"
|
||||
PERSIST_SIZE=$(lsblk -bno SIZE "$PERSIST_PART" 2>/dev/null | numfmt --to=iec --suffix=B || echo "?")
|
||||
note_action "Created persistence partition ${PERSIST_PART} (${PERSIST_SIZE}) on ${BOOT_DRIVE}"
|
||||
fi
|
||||
|
||||
# Mount the persistence partition + lay out the on-disk structure.
|
||||
|
|
@ -183,6 +196,7 @@ fi
|
|||
if ! pg_lsclusters -h | awk '{print $1,$2}' | grep -q "^${PG_VERSION} main$"; then
|
||||
progress "Setting up Postgres cluster..."
|
||||
pg_createcluster "${PG_VERSION}" main
|
||||
note_action "Set up PostgreSQL ${PG_VERSION} cluster at /media/wrolpi/config/postgresql/"
|
||||
fi
|
||||
progress "Starting Postgres..."
|
||||
systemctl start "postgresql@${PG_VERSION}-main.service"
|
||||
|
|
@ -192,6 +206,7 @@ systemctl start "postgresql@${PG_VERSION}-main.service"
|
|||
if ! sudo -iu postgres psql -lqt | cut -d \| -f 1 | grep -qw wrolpi; then
|
||||
progress "Initializing WROLPi database (this can take a minute)..."
|
||||
/opt/wrolpi/scripts/initialize_api_db.sh
|
||||
note_action "Initialized the WROLPi database"
|
||||
fi
|
||||
|
||||
# --- Certificates -------------------------------------------------------
|
||||
|
|
@ -227,5 +242,19 @@ progress "Starting WROLPi services..."
|
|||
systemctl enable wrolpi-api.service wrolpi-app.service wrolpi-kiwix.service
|
||||
systemctl start --no-block wrolpi-api.service wrolpi-app.service wrolpi-kiwix.service
|
||||
|
||||
# If we did anything notable, leave a summary for the XFCE autostart to
|
||||
# show as a zenity dialog once the user lands on the desktop.
|
||||
if [ -n "$SUMMARY" ]; then
|
||||
cat > "$SUMMARY_FILE" <<EOF
|
||||
WROLPi finished setting itself up:
|
||||
|
||||
$SUMMARY
|
||||
These persist between reboots:
|
||||
/media/wrolpi — your library (videos, archives, zims, ...)
|
||||
/media/wrolpi/config — configuration + Postgres data
|
||||
EOF
|
||||
chmod 0644 "$SUMMARY_FILE"
|
||||
fi
|
||||
|
||||
progress "WROLPi is ready."
|
||||
log "bootstrap complete"
|
||||
|
|
|
|||
|
|
@ -90,5 +90,6 @@ vim
|
|||
vlc
|
||||
wget
|
||||
wpasupplicant
|
||||
zenity
|
||||
zim-tools
|
||||
zlib1g-dev
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue