Files
reterminal-dm4/chromium-setup/emmc-provisioning/cloud-init/set-wallpaper-once.sh

21 lines
822 B
Bash

#!/bin/bash
# One-shot: set desktop wallpaper to splash image, then remove self. Runs as user pi at first login.
# Logs to /var/log/first-boot.log (same as first-boot.sh).
FIRST_BOOT_LOG="/var/log/first-boot.log"
log() { echo "[$(date -Iseconds)] [set-wallpaper-once] $*" >> "$FIRST_BOOT_LOG" 2>/dev/null || true; }
export DISPLAY=:0
log "started (DISPLAY=$DISPLAY)"
log "waiting 8s for desktop ..."
sleep 8
WALLPAPER="/usr/share/rpd-wallpaper/splash.png"
if [[ -f "$WALLPAPER" ]]; then
log "applying wallpaper $WALLPAPER"
plasma-apply-wallpaperimage "$WALLPAPER" 2>&1 | while read -r line; do log "$line"; done
else
log "WARNING: wallpaper not found $WALLPAPER"
fi
log "removing one-shot desktop and script"
rm -f /home/pi/.config/autostart/set-wallpaper-once.desktop /home/pi/set-wallpaper-once.sh
log "finished"