From 0e6c44d5e94ea45ee54a467c3a72235ccd07917a Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 22 May 2026 20:22:12 -0600 Subject: [PATCH] Building the React app in chroot and signalling drive-ready to Controller. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The chroot hook only ran `npm install`, leaving /opt/wrolpi/app/build/ missing. wrolpi-app.service runs `serve build -l 3000 ...`, so it started fine but returned 404 for every path. RPi-OS / Debian installs handle this via repair.sh at first boot; we bake the build into the squashfs so the live image works offline immediately. The Controller's `is_primary_drive_mounted()` checks for /media/wrolpi/config/controller.yaml — without it the Controller renders its onboarding wizard and offers the persistence partition (sdb3, mounted at /mnt/persistence) as an unconfigured candidate, which would corrupt the running system if selected. Touch an empty controller.yaml after creating /media/wrolpi/config so the Controller treats the drive as configured. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../config/hooks/normal/9999-wrolpi.hook.chroot | 7 +++++++ .../usr/local/sbin/wrolpi-portable-bootstrap.sh | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/wrolpi-portable/config/hooks/normal/9999-wrolpi.hook.chroot b/wrolpi-portable/config/hooks/normal/9999-wrolpi.hook.chroot index 1c9215f7..56814dc9 100755 --- a/wrolpi-portable/config/hooks/normal/9999-wrolpi.hook.chroot +++ b/wrolpi-portable/config/hooks/normal/9999-wrolpi.hook.chroot @@ -56,6 +56,13 @@ npm --version node --version npm install +# Build the React production bundle. Without this, /opt/wrolpi/app/build/ +# does not exist and wrolpi-app.service (`serve build -l 3000 ...`) returns +# 404 for every request. RPi-OS / Debian-12 installs do this from repair.sh +# at first boot; we bake it into the squashfs so the live image works +# offline immediately. +BROWSERSLIST_IGNORE_OLD_DATA=true npm run build + # Install Node console commands. npm i -g serve@12.0.1 single-file-cli@2.0.73 readability-extractor@0.0.6 diff --git a/wrolpi-portable/config/includes.chroot/usr/local/sbin/wrolpi-portable-bootstrap.sh b/wrolpi-portable/config/includes.chroot/usr/local/sbin/wrolpi-portable-bootstrap.sh index 94cf0023..e05ae826 100644 --- a/wrolpi-portable/config/includes.chroot/usr/local/sbin/wrolpi-portable-bootstrap.sh +++ b/wrolpi-portable/config/includes.chroot/usr/local/sbin/wrolpi-portable-bootstrap.sh @@ -157,6 +157,16 @@ chown wrolpi:wrolpi /media/wrolpi 2>/dev/null || true mkdir -p /media/wrolpi/config chown wrolpi:wrolpi /media/wrolpi/config +# Signal to the Controller that the primary drive is set up. The Controller +# treats /media/wrolpi/config/controller.yaml as the "drive is configured" +# sentinel (see controller.lib.config.is_primary_drive_mounted); without it +# the Controller renders its onboarding wizard and offers the persistence +# partition as an unconfigured candidate. Empty YAML is valid and yields +# the defaults. +if [ ! -e /media/wrolpi/config/controller.yaml ]; then + install -o wrolpi -g wrolpi -m 0644 /dev/null /media/wrolpi/config/controller.yaml +fi + # --- Enable and start the WROLPi runtime services ----------------------- # These units declare `After=wrolpi-portable-bootstrap.service` (via our # Before= here in this unit), so a blocking `systemctl --now` would deadlock: