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,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
|
||||
|
||||
Reference in New Issue
Block a user