mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Showing bootstrap progress on the Plymouth splash.
The bootstrap script can take 30-60s on first boot (partition creation, Postgres cluster init, Alembic migrations). Plymouth is up that whole time since lightdm waits for bootstrap to finish. Push a status line via 'plymouth display-message --text=...' at each major milestone so the user sees what's happening instead of staring at a frozen splash. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e856e4f67e
commit
52cedd48b6
1 changed files with 21 additions and 5 deletions
|
|
@ -21,6 +21,18 @@ set -euo pipefail
|
|||
|
||||
log() { echo "[wrolpi-portable-bootstrap] $*"; }
|
||||
|
||||
# Show progress on the Plymouth splash so the user sees what's happening
|
||||
# during the 30-60s first-boot work. Plymouth is up between initramfs and
|
||||
# lightdm starting; we block lightdm via systemd ordering, so the splash
|
||||
# owns the screen for our entire run. Falls back to log-only if Plymouth
|
||||
# isn't active (e.g. running this script manually over SSH).
|
||||
progress() {
|
||||
plymouth display-message --text="$1" 2>/dev/null || true
|
||||
log "$1"
|
||||
}
|
||||
|
||||
progress "Preparing WROLPi Portable..."
|
||||
|
||||
# --- Identify the boot drive ---------------------------------------------
|
||||
|
||||
# live-boot uses one of these mount points depending on version / config.
|
||||
|
|
@ -42,7 +54,7 @@ log "live medium $BOOT_PART on $BOOT_DRIVE"
|
|||
|
||||
PERSIST_PART=$(blkid -L persistence 2>/dev/null || true)
|
||||
if [ -z "$PERSIST_PART" ]; then
|
||||
log "no persistence partition found; creating one on $BOOT_DRIVE"
|
||||
progress "Creating persistence partition on $BOOT_DRIVE..."
|
||||
# Compute next 1-MiB-aligned start sector after the last existing partition.
|
||||
LAST_END=$(sfdisk -d "$BOOT_DRIVE" | awk '/^\/dev\// {n=$4+$6} END{print n}')
|
||||
START=$(( ((LAST_END + 2047) / 2048) * 2048 ))
|
||||
|
|
@ -61,7 +73,7 @@ if [ -z "$PERSIST_PART" ]; then
|
|||
log "ERROR: failed to locate the newly created persistence partition"
|
||||
exit 1
|
||||
fi
|
||||
log "formatting $PERSIST_PART as ext4 with label 'persistence'"
|
||||
progress "Formatting $PERSIST_PART as ext4..."
|
||||
mkfs.ext4 -L persistence -F "$PERSIST_PART"
|
||||
fi
|
||||
|
||||
|
|
@ -101,15 +113,16 @@ bind_if_unmounted /mnt/persistence/wrolpi /media/wrolpi
|
|||
# --- Postgres cluster ----------------------------------------------------
|
||||
|
||||
if ! pg_lsclusters -h | awk '{print $1,$2}' | grep -q "^15 main$"; then
|
||||
log "creating Postgres cluster 15/main on persistence"
|
||||
progress "Setting up Postgres cluster..."
|
||||
pg_createcluster 15 main
|
||||
fi
|
||||
progress "Starting Postgres..."
|
||||
systemctl start postgresql@15-main.service
|
||||
|
||||
# --- WROLPi DB schema + initial config import ----------------------------
|
||||
|
||||
if ! sudo -iu postgres psql -lqt | cut -d \| -f 1 | grep -qw wrolpi; then
|
||||
log "initializing WROLPi database"
|
||||
progress "Initializing WROLPi database (this can take a minute)..."
|
||||
/opt/wrolpi/scripts/initialize_api_db.sh
|
||||
fi
|
||||
|
||||
|
|
@ -117,12 +130,13 @@ fi
|
|||
# CA persists in /media/wrolpi/config/ssl/ (created on first run). Leaf
|
||||
# cert is regenerated every boot so SANs reflect the current hostname/IP.
|
||||
|
||||
progress "Generating TLS certificate..."
|
||||
/opt/wrolpi/scripts/generate_certificates.sh
|
||||
|
||||
# --- Caddy: swap onboarding stub for the full Caddyfile if needed --------
|
||||
|
||||
if ! diff -q /opt/wrolpi/etc/raspberrypios/Caddyfile /etc/caddy/Caddyfile >/dev/null 2>&1; then
|
||||
log "swapping onboarding Caddyfile for the full Caddyfile"
|
||||
progress "Configuring Caddy..."
|
||||
cp /opt/wrolpi/etc/raspberrypios/Caddyfile /etc/caddy/Caddyfile
|
||||
systemctl restart caddy || true
|
||||
fi
|
||||
|
|
@ -135,6 +149,8 @@ chown wrolpi:wrolpi /media/wrolpi/config
|
|||
|
||||
# --- Enable and start the WROLPi runtime services -----------------------
|
||||
|
||||
progress "Starting WROLPi services..."
|
||||
systemctl enable --now wrolpi-api.service wrolpi-app.service wrolpi-kiwix.service
|
||||
|
||||
progress "WROLPi Portable is ready."
|
||||
log "bootstrap complete"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue