Refactor first-boot process to introduce ordered execution and new one-shot scripts
Revise the first-boot script to implement a structured approach with 13 numbered steps, allowing for better control over the execution order. Introduce two new one-shot scripts: `01-set-rotation-once.sh` and `02-set-wallpaper-once.sh`, replacing the previous single script approach. Update documentation to reflect these changes, including the new configuration options for enabling/disabling steps and the revised file structure for one-shot scripts. Enhance the dashboard to display first-boot progress, improving user feedback during the initial setup.
This commit is contained in:
37
emmc-provisioning/cloud-init/02-set-wallpaper-once.sh
Normal file
37
emmc-provisioning/cloud-init/02-set-wallpaper-once.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# One-shot: set desktop wallpaper for labwc (swaybg) and persist via labwc autostart, then remove self.
|
||||
# Runs as user pi at first login. Logs to /var/log/first-boot.log.
|
||||
FIRST_BOOT_LOG="/var/log/first-boot.log"
|
||||
BASE="$(basename "$0" .sh)"
|
||||
log() { echo "[$(date -Iseconds)] [$BASE] $*" >> "$FIRST_BOOT_LOG" 2>/dev/null || true; }
|
||||
|
||||
WALLPAPER="/usr/share/rpd-wallpaper/splash.png"
|
||||
LABWC_AUTOSTART="$HOME/.config/labwc/autostart"
|
||||
|
||||
log "started (labwc/swaybg)"
|
||||
log "waiting 8s for compositor ..."
|
||||
sleep 8
|
||||
|
||||
if [[ ! -f "$WALLPAPER" ]]; then
|
||||
log "WARNING: wallpaper not found $WALLPAPER"
|
||||
else
|
||||
mkdir -p "$(dirname "$LABWC_AUTOSTART")"
|
||||
if [[ ! -f "$LABWC_AUTOSTART" ]]; then
|
||||
echo '#!/bin/sh' > "$LABWC_AUTOSTART"
|
||||
chmod +x "$LABWC_AUTOSTART"
|
||||
fi
|
||||
if ! grep -q 'swaybg.*splash.png' "$LABWC_AUTOSTART" 2>/dev/null; then
|
||||
echo "swaybg -i $WALLPAPER -m fill &" >> "$LABWC_AUTOSTART"
|
||||
log "added swaybg to labwc autostart"
|
||||
fi
|
||||
if command -v swaybg &>/dev/null; then
|
||||
log "applying wallpaper now: $WALLPAPER"
|
||||
swaybg -i "$WALLPAPER" -m fill &
|
||||
else
|
||||
log "WARNING: swaybg not installed"
|
||||
fi
|
||||
fi
|
||||
|
||||
log "removing one-shot desktop and script"
|
||||
rm -f "$HOME/.config/autostart/${BASE}.desktop" "$HOME/${BASE}.sh"
|
||||
log "finished"
|
||||
Reference in New Issue
Block a user