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:
@@ -2,6 +2,18 @@
|
||||
# Sync portal (file server) content from the repo to the LXC.
|
||||
# Updates /var/lib/cm4-provisioning/portal-files/ so first-boot and the
|
||||
# dashboard /files/ serve the same scripts and assets as in the repo.
|
||||
#
|
||||
# Files first-boot.sh downloads from FILE_SERVER (../files/first-boot/):
|
||||
# Required: start-chromium.sh, chromium-kiosk.desktop, splash.png,
|
||||
# custom.plymouth, custom.script, 99-wallpaper.conf,
|
||||
# 99-default-session.conf, maliit-keyboard.desktop
|
||||
# One-shots (if ONESHOT_SCRIPTS set): <name>.sh + <name>.desktop
|
||||
# e.g. 01-set-rotation-once.sh, 01-set-rotation-once.desktop,
|
||||
# 02-set-wallpaper-once.sh, 02-set-wallpaper-once.desktop
|
||||
# Optional: first-boot.conf (downloaded to /tmp by cloud-init runcmd)
|
||||
# Note: splash.png is not in the repo; add it to plymouth-custom/ or upload
|
||||
# via the portal if you want a custom boot splash.
|
||||
#
|
||||
# Usage: ./sync-portal-files-to-lxc.sh [user@lxc_ip]
|
||||
# Example: ./sync-portal-files-to-lxc.sh root@10.130.60.141
|
||||
|
||||
@@ -22,25 +34,32 @@ echo "Syncing portal files to $LXC ($REMOTE_PORTAL) ..."
|
||||
ssh "$LXC" "command -v rsync >/dev/null 2>&1 || (apt-get update -qq && apt-get install -y rsync)"
|
||||
ssh "$LXC" "mkdir -p $REMOTE_FIRST_BOOT"
|
||||
|
||||
# first-boot.sh at portal root (cloud-init downloads it by URL, not from first-boot/ subfolder)
|
||||
# --- Portal root (URL /files/...) ---
|
||||
# first-boot.sh: cloud-init runcmd downloads this
|
||||
rsync -avz "$CLOUDINIT_DIR/first-boot.sh" "$LXC:$REMOTE_PORTAL/"
|
||||
# Optional config: cloud-init can download to /tmp/first-boot.conf before running first-boot.sh
|
||||
rsync -avz "$CLOUDINIT_DIR/first-boot.conf.example" "$LXC:$REMOTE_PORTAL/"
|
||||
[[ -f "$CLOUDINIT_DIR/first-boot.conf" ]] && rsync -avz "$CLOUDINIT_DIR/first-boot.conf" "$LXC:$REMOTE_PORTAL/" || true
|
||||
|
||||
# config-files/* (includes chromium-kiosk.desktop) → portal-files/first-boot/
|
||||
# --- first-boot/ (URL /files/first-boot/...) ---
|
||||
# Config files: LightDM, Maliit, Chromium kiosk, one-shot .desktop files
|
||||
rsync -avz --exclude='README.md' \
|
||||
"$CLOUDINIT_DIR/config-files/" \
|
||||
"$LXC:$REMOTE_FIRST_BOOT/"
|
||||
|
||||
# start-chromium.sh → portal-files/first-boot/
|
||||
rsync -avz "$CLOUDINIT_DIR/start-chromium.sh" "$LXC:$REMOTE_FIRST_BOOT/"
|
||||
# Kiosk and scripts
|
||||
rsync -avz \
|
||||
"$CLOUDINIT_DIR/start-chromium.sh" \
|
||||
"$CLOUDINIT_DIR/01-set-rotation-once.sh" \
|
||||
"$CLOUDINIT_DIR/02-set-wallpaper-once.sh" \
|
||||
"$CLOUDINIT_DIR/set-rotation-at-login.sh" \
|
||||
"$CLOUDINIT_DIR/fix-reterminal-display.sh" \
|
||||
"$LXC:$REMOTE_FIRST_BOOT/"
|
||||
|
||||
# plymouth-custom/* (custom.plymouth, custom.script, splash.png if present) → portal-files/first-boot/
|
||||
# Plymouth theme (custom.plymouth, custom.script; add splash.png to this dir or upload via portal)
|
||||
rsync -avz \
|
||||
"$CLOUDINIT_DIR/files-from-guard/plymouth-custom/" \
|
||||
"$LXC:$REMOTE_FIRST_BOOT/"
|
||||
|
||||
# one-shot scripts from cloud-init root → portal-files/first-boot/ (wallpaper set in first-boot via labwc autostart)
|
||||
rsync -avz \
|
||||
"$CLOUDINIT_DIR/set-rotation-once.sh" \
|
||||
"$LXC:$REMOTE_FIRST_BOOT/"
|
||||
|
||||
echo "Done. Portal files at http://$(echo "$LXC" | cut -d@ -f2):5000/files/"
|
||||
echo "Note: Add splash.png to $REMOTE_FIRST_BOOT/ (or plymouth-custom/) if you want a custom boot splash."
|
||||
|
||||
Reference in New Issue
Block a user