Building the React app in chroot and signalling drive-ready to Controller.

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) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-05-22 20:22:12 -06:00
parent 8bc84e84ae
commit 0e6c44d5e9
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 17 additions and 0 deletions

View file

@ -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

View file

@ -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: