Update first-boot.sh and associated scripts to transition from KDE Plasma to rpd-labwc for the Chromium kiosk setup. Modify package installations, LightDM session configurations, and one-shot scripts for wallpaper and rotation to support Wayland. Implement boot order configuration for network-first provisioning. Enhance logging and error handling throughout the scripts.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
[Seat:*]
|
||||
user-session=plasmax11
|
||||
autologin-session=plasmax11
|
||||
user-session=rpd-labwc
|
||||
autologin-session=rpd-labwc
|
||||
|
||||
@@ -5,9 +5,7 @@ first-boot.sh downloads these from `FILE_SERVER` (e.g. `http://10.130.60.141:500
|
||||
| File on server | Destination on device |
|
||||
|----------------|------------------------|
|
||||
| 99-wallpaper.conf | /etc/lightdm/lightdm.conf.d/99-wallpaper.conf |
|
||||
| 99-default-session.conf | /etc/lightdm/lightdm.conf.d/99-default-session.conf |
|
||||
| kdeglobals | /home/pi/.config/kdeglobals |
|
||||
| kwinrc | /home/pi/.config/kwinrc |
|
||||
| 99-default-session.conf | /etc/lightdm/lightdm.conf.d/99-default-session.conf (rpd-labwc) |
|
||||
| maliit-keyboard.desktop | /home/pi/.config/autostart/maliit-keyboard.desktop |
|
||||
| set-rotation-once.desktop | /home/pi/.config/autostart/set-rotation-once.desktop (with set-rotation-once.sh) |
|
||||
| set-wallpaper-once.desktop | /home/pi/.config/autostart/set-wallpaper-once.desktop (with set-wallpaper-once.sh) |
|
||||
|
||||
@@ -12,12 +12,10 @@ first-boot.sh downloads from **`.../files/first-boot/`** (e.g. `http://10.130.60
|
||||
| **custom.plymouth** | Plymouth theme config (from `plymouth-custom/`). |
|
||||
| **custom.script** | Plymouth script that displays splash.png (from `plymouth-custom/`). |
|
||||
| **99-wallpaper.conf** | LightDM greeter wallpaper (from `config-files/`). |
|
||||
| **99-default-session.conf** | LightDM default session plasmax11 (from `config-files/`). |
|
||||
| **kdeglobals** | KDE font DPI (from `config-files/`). |
|
||||
| **kwinrc** | KDE window/touch (from `config-files/`). |
|
||||
| **99-default-session.conf** | LightDM default session rpd-labwc (from `config-files/`). |
|
||||
| **maliit-keyboard.desktop** | Maliit on-screen keyboard autostart (from `config-files/`). |
|
||||
| **set-rotation-once.sh** + **.desktop** | One-shot: DSI-1 rotation at first login. |
|
||||
| **set-wallpaper-once.sh** + **.desktop** | One-shot: desktop wallpaper at first login. |
|
||||
| **set-rotation-once.sh** + **.desktop** | One-shot: wlr-randr rotation (Right) at first login. |
|
||||
| **set-wallpaper-once.sh** + **.desktop** | One-shot: swaybg wallpaper + labwc autostart at first login. |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# first-boot.sh — Documentation
|
||||
|
||||
This script runs once on first boot via cloud-init (see `user-data-remote-gnss.example`). It installs packages, configures a Chromium kiosk with KDE Plasma and touch support, and installs the reTerminal DM display/touch drivers. It must run as **root**.
|
||||
This script runs once on first boot via cloud-init (see `user-data-remote-gnss.example`). It installs packages, configures a Chromium kiosk with rpd-labwc (Raspberry Pi Desktop + labwc) and touch support, and installs the reTerminal DM display/touch drivers. It must run as **root**.
|
||||
|
||||
---
|
||||
|
||||
@@ -9,14 +9,16 @@ This script runs once on first boot via cloud-init (see `user-data-remote-gnss.e
|
||||
1. **Constants** — `FILE_SERVER`, `PI_USER`, paths, log file.
|
||||
2. **Logging** — All output tee’d to `/var/log/first-boot.log`.
|
||||
3. **Helpers** — `install_oneshot(name)` downloads `${name}.sh` from the file server and installs it as a one-shot autostart (runs once at pi’s first login, then deletes itself).
|
||||
4. **Packages** — git, Chromium, wmctrl, SSH, KDE Plasma, kscreen, maliit, xinput-calibrator.
|
||||
4. **Packages** — git, Chromium, wmctrl, SSH, swaybg, wlr-randr, maliit, xinput-calibrator.
|
||||
5. **Kiosk files** — Download `start-chromium.sh` and `chromium-kiosk.desktop`; create autostart dir.
|
||||
6. **Boot splash and wallpaper** — Download `splash.png`; install Plymouth custom theme; copy image for LightDM and desktop.
|
||||
7. **LightDM** — Download `99-default-session.conf` and `99-wallpaper.conf` to `/etc/lightdm/lightdm.conf.d/`.
|
||||
8. **KDE + Maliit** — Download `kdeglobals`, `kwinrc`, `maliit-keyboard.desktop` from file server to pi’s `.config` and autostart.
|
||||
7. **LightDM** — Download `99-default-session.conf` (rpd-labwc) and `99-wallpaper.conf` to `/etc/lightdm/lightdm.conf.d/`.
|
||||
8. **Maliit** — Download `maliit-keyboard.desktop` from file server to pi’s autostart.
|
||||
9. **reTerminal DM drivers** — Seeed repo clone and `reTerminal.sh`.
|
||||
10. **One-shots** — Download `set-rotation-once.sh` + `.desktop` and `set-wallpaper-once.sh` + `.desktop` from file server.
|
||||
11. **Reboot.**
|
||||
10. **Re-apply splash** — Set `disable_splash=0`, Plymouth theme to `custom` only, `update-initramfs`.
|
||||
11. **Boot order** — If `rpi-eeprom-config` is available, set `BOOT_ORDER=0x21` (network first, then eMMC/SD) for future network boot / re-provisioning.
|
||||
12. **One-shots** — Download `set-rotation-once.sh` + `.desktop` and `set-wallpaper-once.sh` + `.desktop` from file server (wlr-randr + swaybg for labwc).
|
||||
13. **Reboot.**
|
||||
|
||||
---
|
||||
|
||||
@@ -47,8 +49,8 @@ Installs the software needed for the rest of the script and for the kiosk:
|
||||
| **chromium-browser** | Full-screen kiosk browser. |
|
||||
| **wmctrl** | Window control; used to force Chromium into fullscreen. |
|
||||
| **openssh-server** | SSH access (often also enabled in user-data). |
|
||||
| **kde-plasma-desktop** | KDE Plasma desktop (X11 session used for Chromium). |
|
||||
| **kscreen** | KDE display control; provides `kscreen-doctor` for screen rotation (same as GUI “Right”). |
|
||||
| **swaybg** | Wallpaper for labwc (Wayland); used by one-shot and labwc autostart. |
|
||||
| **wlr-randr** | Display rotation for wlroots/labwc; one-shot sets “Right” (transform 90). |
|
||||
| **maliit-keyboard** | On-screen keyboard for touch input. |
|
||||
| **xinput-calibrator** | Touchscreen calibration (optional; run manually if needed). |
|
||||
|
||||
@@ -78,24 +80,13 @@ A **single image** (`splash.png`) is used for the boot splash, login screen, and
|
||||
|
||||
- **Plymouth (boot splash):** Downloads `splash.png`, `custom.plymouth`, and `custom.script` from the file server → installs to `/usr/share/plymouth/themes/custom/` → sets `Theme=custom` in `/etc/plymouth/plymouthd.conf` → runs `update-initramfs -u`. If any download fails, logs a warning and continues.
|
||||
- **LightDM (login screen):** Copies the same image to `/usr/share/rpd-wallpaper/splash.png` and writes `/etc/lightdm/lightdm.conf.d/99-wallpaper.conf` with `wallpaper=...` and `wallpaper_mode=crop`.
|
||||
- **Desktop wallpaper:** A one-shot autostart runs when **pi** first logs in and runs `plasma-apply-wallpaperimage /usr/share/rpd-wallpaper/splash.png`. The script then deletes itself. If `plasma-apply-wallpaperimage` is not installed, the step no-ops and the one-shot still removes itself.
|
||||
- **Desktop wallpaper:** A one-shot autostart runs when **pi** first logs in: it adds `swaybg -i /usr/share/rpd-wallpaper/splash.png -m fill` to `~/.config/labwc/autostart` (so it persists across logins) and runs swaybg for the current session. The one-shot then deletes itself.
|
||||
|
||||
---
|
||||
|
||||
## KDE Plasma: default session (X11)
|
||||
## LightDM: default session (rpd-labwc)
|
||||
|
||||
Writes `/etc/lightdm/lightdm.conf.d/99-default-session.conf` so the display manager (LightDM) uses the **Plasma X11** session (`plasmax11`) instead of Wayland. Chromium kiosk is configured for X11, so this is required for it to run correctly.
|
||||
|
||||
---
|
||||
|
||||
## KDE touch-friendly settings
|
||||
|
||||
Two config files for user `pi` to improve touch and window behaviour:
|
||||
|
||||
- **`/home/pi/.config/kdeglobals`** — `ForceFontDPI=120` for larger, more readable UI on the small screen.
|
||||
- **`/home/pi/.config/kwinrc`** — `BorderlessMaximizedWindows=true` and `touchpointsEnabled=true` for better touch and fullscreen behaviour.
|
||||
|
||||
Both are owned by `pi:pi` with mode 644.
|
||||
Writes `/etc/lightdm/lightdm.conf.d/99-default-session.conf` so the display manager (LightDM) uses the **rpd-labwc** session (Raspberry Pi Desktop with labwc Wayland compositor). The script also patches `/etc/lightdm/lightdm.conf` so `user-session` and `autologin-session` are `rpd-labwc`.
|
||||
|
||||
---
|
||||
|
||||
@@ -111,12 +102,6 @@ Runs `chown -R pi:pi /home/pi/.config` so all files under `pi`’s config direct
|
||||
|
||||
---
|
||||
|
||||
## Default X session manager
|
||||
|
||||
Runs `update-alternatives --set x-session-manager /usr/bin/startplasma-x11` so the default graphical session is KDE Plasma on X11. Matches the LightDM setting above and ensures the kiosk and Maliit run in the same X11 session.
|
||||
|
||||
---
|
||||
|
||||
## reTerminal DM: Seeed display/touch drivers
|
||||
|
||||
Installs the official Seeed drivers for the reTerminal DM so the display and touch work:
|
||||
@@ -131,15 +116,19 @@ These changes take effect after a reboot.
|
||||
|
||||
## Screen rotation (portrait → landscape, “Right”)
|
||||
|
||||
The reTerminal DM default is portrait. Rotation is set the **same way as in the GUI** (Display settings → Orientation → Right), using KDE’s **kscreen-doctor**, so nothing is written to `/boot/firmware/config.txt`.
|
||||
The reTerminal DM default is portrait. Rotation is set using **wlr-randr** (labwc/Wayland), so nothing is written to `/boot/firmware/config.txt`.
|
||||
|
||||
- **One-shot autostart** — A small script runs once when user `pi` first logs into the graphical session:
|
||||
- **`/home/pi/set-rotation-once.sh`** — Waits 5 seconds, then runs `kscreen-doctor output.DSI-1.rotation.right` (only the reTerminal DM DSI-1 display; no other screen is used).
|
||||
- **`/home/pi/set-rotation-once.sh`** — Waits 5 seconds, detects the output name with `wlr-randr`, then runs `wlr-randr --output <name> --transform 90` (Right / 90° clockwise). Falls back to `DSI-1` if detection fails.
|
||||
- **`/home/pi/.config/autostart/set-rotation-once.desktop`** — Autostart entry that runs the script. Both the script and this desktop file **delete themselves** after a successful run, so rotation is applied only once.
|
||||
- **Effect** — Same as choosing “Right” in System Settings → Display → Orientation. Rotation applies after the first login; no reboot needed for rotation (only for the Seeed drivers).
|
||||
- **Effect** — Same as choosing “Right” in display settings. Rotation applies after the first login; no reboot needed for rotation (only for the Seeed drivers).
|
||||
|
||||
---
|
||||
|
||||
## Boot order (network first, then eMMC/SD)
|
||||
|
||||
If **`rpi-eeprom-config`** and **`rpi-eeprom-update`** are present (Pi 4/CM4), the script sets the EEPROM **`BOOT_ORDER=0x21`**: try **network** first (0x2), then **SD/eMMC** (0x1). This allows future network boot or re-provisioning (e.g. PXE or USB gadget) before falling back to local storage. The EEPROM update is scheduled for the next reboot; no second reboot is required. If the tools are not available, the step is skipped.
|
||||
|
||||
## Reboot
|
||||
|
||||
Runs **`reboot`** so the kernel and display stack load the new Seeed drivers. After reboot, the screen and touch work; on **pi**’s first login the one-shot sets rotation to “Right” (landscape), and the Chromium kiosk and Maliit start via autostart.
|
||||
@@ -148,7 +137,7 @@ Runs **`reboot`** so the kernel and display stack load the new Seeed drivers. Af
|
||||
|
||||
## Customisation
|
||||
|
||||
- **File server** — Edit `FILE_SERVER` if your assets are served from another host/port. Host all files listed in **`files-from-guard/README.md`** and **`config-files/README.md`** (kiosk, splash, Plymouth, LightDM, KDE, Maliit, one-shots and their .desktop files).
|
||||
- **File server** — Edit `FILE_SERVER` if your assets are served from another host/port. Host all files listed in **`files-from-guard/README.md`** and **`config-files/README.md`** (kiosk, splash, Plymouth, LightDM, Maliit, one-shots and their .desktop files).
|
||||
- **Kiosk URL** — The URL Chromium opens is defined in `start-chromium.sh` on your file server (e.g. `--app=http://127.0.0.1:8080`); change it there.
|
||||
- **User** — If you use a user other than `pi`, replace `pi` in this script and in the files on the file server (paths and ownership).
|
||||
- **Screen rotation** — The one-shot runs `kscreen-doctor output.DSI-1.rotation.right`. To use another orientation, edit the script and change `rotation.right` to `rotation.left`, `rotation.inverted`, or `rotation.none`.
|
||||
- **Screen rotation** — The one-shot runs `wlr-randr --output <name> --transform 90`. To use another orientation, change `90` to `270` (left), `180` (inverted), or `normal`.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# First-boot: packages, Chromium kiosk, KDE Plasma + touch, reTerminal DM drivers.
|
||||
# First-boot: packages, Chromium kiosk, rpd-labwc + touch, reTerminal DM drivers.
|
||||
# Run by cloud-init (user-data-remote-gnss.example). Run as root.
|
||||
|
||||
set -e
|
||||
@@ -57,9 +57,9 @@ install_oneshot() {
|
||||
log "--- Installing packages ---"
|
||||
log "Running apt-get update ..."
|
||||
apt-get update -qq
|
||||
log "Installing: git chromium wmctrl openssh-server kde-plasma-desktop kscreen maliit-keyboard xinput-calibrator"
|
||||
log "Installing: git chromium wmctrl openssh-server swaybg wlr-randr maliit-keyboard xinput-calibrator"
|
||||
apt-get install -y -qq git chromium wmctrl openssh-server \
|
||||
kde-plasma-desktop kscreen maliit-keyboard xinput-calibrator
|
||||
swaybg wlr-randr maliit-keyboard xinput-calibrator
|
||||
log "Packages installed successfully"
|
||||
|
||||
# --- 2. Dirs and kiosk files from file server ---
|
||||
@@ -99,8 +99,8 @@ else
|
||||
log "WARNING: Could not download splash.png"
|
||||
fi
|
||||
|
||||
# --- 4. LightDM: KDE Plasma X11 session + configs from file server ---
|
||||
log "--- LightDM session ---"
|
||||
# --- 4. LightDM: rpd-labwc session + configs from file server ---
|
||||
log "--- LightDM session (rpd-labwc) ---"
|
||||
mkdir -p /etc/lightdm/lightdm.conf.d
|
||||
if curl -fsSL "${FILE_SERVER}/99-default-session.conf" -o /etc/lightdm/lightdm.conf.d/99-default-session.conf 2>/dev/null; then
|
||||
log "99-default-session.conf installed"
|
||||
@@ -109,19 +109,16 @@ else
|
||||
fi
|
||||
# Raspberry Pi OS may apply main lightdm.conf after .conf.d; force session in main config too
|
||||
if [[ -f /etc/lightdm/lightdm.conf ]]; then
|
||||
sed -i 's/^user-session=.*/user-session=plasmax11/' /etc/lightdm/lightdm.conf
|
||||
sed -i 's/^autologin-session=.*/autologin-session=plasmax11/' /etc/lightdm/lightdm.conf
|
||||
log "Patched /etc/lightdm/lightdm.conf to use plasmax11"
|
||||
sed -i 's/^user-session=.*/user-session=rpd-labwc/' /etc/lightdm/lightdm.conf
|
||||
sed -i 's/^autologin-session=.*/autologin-session=rpd-labwc/' /etc/lightdm/lightdm.conf
|
||||
log "Patched /etc/lightdm/lightdm.conf to use rpd-labwc"
|
||||
fi
|
||||
|
||||
# --- 5. KDE touch-friendly + Maliit (from file server) ---
|
||||
log "--- KDE and Maliit ---"
|
||||
# --- 5. Maliit on-screen keyboard (from file server) ---
|
||||
log "--- Maliit ---"
|
||||
mkdir -p "$AUTOSTART" "$PI_HOME/.config"
|
||||
curl -fsSL "${FILE_SERVER}/kdeglobals" -o "$PI_HOME/.config/kdeglobals" 2>/dev/null && log "kdeglobals installed" || log "WARNING: Could not download kdeglobals"
|
||||
curl -fsSL "${FILE_SERVER}/kwinrc" -o "$PI_HOME/.config/kwinrc" 2>/dev/null && log "kwinrc installed" || log "WARNING: Could not download kwinrc"
|
||||
curl -fsSL "${FILE_SERVER}/maliit-keyboard.desktop" -o "$AUTOSTART/maliit-keyboard.desktop" 2>/dev/null && log "maliit-keyboard.desktop installed" || log "WARNING: Could not download maliit-keyboard.desktop"
|
||||
chown -R "$PI_USER:$PI_USER" "$PI_HOME/.config"
|
||||
update-alternatives --set x-session-manager /usr/bin/startplasma-x11 2>/dev/null && log "Default x-session-manager set to startplasma-x11" || true
|
||||
|
||||
# --- 6. reTerminal DM drivers (Seeed) ---
|
||||
log "--- reTerminal DM drivers ---"
|
||||
@@ -158,6 +155,30 @@ fi
|
||||
log "Running update-initramfs to apply Plymouth theme ..."
|
||||
update-initramfs -u -k all 2>/dev/null || true
|
||||
|
||||
# --- 6c. Boot order: network first, then eMMC/SD (for future network boot / re-provisioning) ---
|
||||
# BOOT_ORDER: 0x2 = network, 0x1 = SD/eMMC. 0x21 = try network first, then local storage.
|
||||
log "--- Boot order (network first, then eMMC/SD) ---"
|
||||
if command -v rpi-eeprom-config >/dev/null 2>&1 && command -v rpi-eeprom-update >/dev/null 2>&1; then
|
||||
BOOTCONF="/tmp/first-boot-eeprom-conf.txt"
|
||||
if PEE="$(rpi-eeprom-update -l 2>/dev/null)" && [[ -n "$PEE" ]] && [[ -f "$PEE" ]]; then
|
||||
rpi-eeprom-config "$PEE" > "$BOOTCONF" 2>/dev/null || true
|
||||
fi
|
||||
if [[ -s "$BOOTCONF" ]]; then
|
||||
sed -i 's/^BOOT_ORDER=.*/BOOT_ORDER=0x21/' "$BOOTCONF"
|
||||
grep -q '^BOOT_ORDER=' "$BOOTCONF" || echo 'BOOT_ORDER=0x21' >> "$BOOTCONF"
|
||||
if rpi-eeprom-config --apply "$BOOTCONF" 2>/dev/null; then
|
||||
log "Boot order set to 0x21 (network first, then eMMC/SD); EEPROM update scheduled for next reboot"
|
||||
else
|
||||
log "WARNING: rpi-eeprom-config --apply failed; boot order unchanged"
|
||||
fi
|
||||
else
|
||||
log "WARNING: Could not read current EEPROM config; skipping boot order change"
|
||||
fi
|
||||
rm -f "$BOOTCONF"
|
||||
else
|
||||
log "rpi-eeprom-config/rpi-eeprom-update not found; skipping boot order (not a Pi4/CM4 or package missing)"
|
||||
fi
|
||||
|
||||
# --- 7. One-shots (rotation + wallpaper at first login) ---
|
||||
log "--- One-shot scripts (run at pi first login) ---"
|
||||
install_oneshot set-rotation-once || true
|
||||
|
||||
@@ -25,11 +25,10 @@ if [[ -f /etc/plymouth/plymouthd.conf ]]; then
|
||||
fi
|
||||
update-initramfs -u -k all 2>/dev/null || true
|
||||
|
||||
echo "=== Rotation and wallpaper (run as $PI_USER at next login or now via sudo -u) ==="
|
||||
echo "To set rotation and wallpaper now (with X running), run as $PI_USER:"
|
||||
echo " export DISPLAY=:0"
|
||||
echo " kscreen-doctor output.DSI-1.rotation.right"
|
||||
echo " plasma-apply-wallpaperimage /usr/share/rpd-wallpaper/splash.png"
|
||||
echo "=== Rotation and wallpaper (rpd-labwc / labwc Wayland) ==="
|
||||
echo "To set rotation and wallpaper now (in a labwc session), run as $PI_USER:"
|
||||
echo " wlr-randr --output \$(wlr-randr | awk '/^[A-Za-z0-9_-]+ /{print \$1; exit}') --transform 90"
|
||||
echo " swaybg -i /usr/share/rpd-wallpaper/splash.png -m fill &"
|
||||
echo ""
|
||||
echo "Or ensure one-shots run at next login (they are in autostart if still present)."
|
||||
echo "=== Reboot to apply splash and initramfs ==="
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
#!/bin/bash
|
||||
# One-shot: set DSI-1 (reTerminal DM) rotation to Right, then remove self. Runs as user pi at first login.
|
||||
# Logs to /var/log/first-boot.log (same as first-boot.sh).
|
||||
# One-shot: set reTerminal DM (labwc/Wayland) rotation to Right via wlr-randr, 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"
|
||||
log() { echo "[$(date -Iseconds)] [set-rotation-once] $*" >> "$FIRST_BOOT_LOG" 2>/dev/null || true; }
|
||||
|
||||
export DISPLAY=:0
|
||||
log "started (DISPLAY=$DISPLAY)"
|
||||
log "waiting 5s for display ..."
|
||||
log "started (labwc/wlr-randr)"
|
||||
log "waiting 5s for compositor ..."
|
||||
sleep 5
|
||||
log "running kscreen-doctor output.DSI-1.rotation.right"
|
||||
kscreen-doctor output.DSI-1.rotation.right 2>&1 | while read -r line; do log "$line"; done
|
||||
|
||||
OUTPUT=""
|
||||
if command -v wlr-randr &>/dev/null; then
|
||||
OUTPUT=$(wlr-randr 2>/dev/null | awk '/^[A-Za-z0-9_-]+ /{print $1; exit}')
|
||||
fi
|
||||
if [[ -z "$OUTPUT" ]]; then
|
||||
OUTPUT="DSI-1"
|
||||
log "using default output: $OUTPUT"
|
||||
fi
|
||||
|
||||
if [[ -n "$OUTPUT" ]] && command -v wlr-randr &>/dev/null; then
|
||||
log "applying rotation right (transform 90) on $OUTPUT"
|
||||
wlr-randr --output "$OUTPUT" --transform 90 2>&1 | while read -r line; do log "$line"; done
|
||||
else
|
||||
log "WARNING: wlr-randr not found or no output"
|
||||
fi
|
||||
|
||||
log "removing one-shot desktop and script"
|
||||
rm -f /home/pi/.config/autostart/set-rotation-once.desktop /home/pi/set-rotation-once.sh
|
||||
log "finished"
|
||||
|
||||
@@ -1,20 +1,36 @@
|
||||
#!/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).
|
||||
# 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"
|
||||
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
|
||||
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/pi/.config/autostart/set-wallpaper-once.desktop /home/pi/set-wallpaper-once.sh
|
||||
log "finished"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#cloud-config
|
||||
# Example: create user (pi), enable SSH, then download and run first-boot.sh to install
|
||||
# Chromium kiosk, KDE Plasma, and touch options. Edit FIRST_BOOT_URL to point to your
|
||||
# Chromium kiosk, rpd-labwc, and touch options. Edit FIRST_BOOT_URL to point to your
|
||||
# hosted first-boot.sh (e.g. file server or raw GitHub).
|
||||
#
|
||||
# 1. Generate a password hash: mkpasswd -m sha-512 'YourPassword' or openssl passwd -6 'YourPassword'
|
||||
|
||||
Reference in New Issue
Block a user