wrolpi/scripts
lrnselfreliance 944d95c717
Bake the app build into images; rebuild on-device only when stale (#536)
* Bake the app build into images; rebuild on-device only when stale

Previously the Raspberry Pi image shipped without app/build/ and compiled
the React bundle on first boot via repair.sh -- a multi-minute, memory-hungry
step that can OOM a 2GB Pi.  The Debian Live ISO already baked the build in,
so the two paths had drifted.

Add scripts/build_app.sh as the single source of truth: it hashes the build
inputs (src/, public/, package.json, package-lock.json, tsconfig.json) and
runs `npm run build` (with GENERATE_SOURCEMAP=false) only when build/ is
missing or those inputs changed, then writes build/.build-stamp.

Wire all three call sites to it:
- pi-gen 03-run-chroot.sh now builds after npm install, baking build/ into
  the Pi image like the Debian hook already does.
- debian-live 9999-wrolpi.hook.chroot uses it so the baked build is stamped.
- repair.sh uses it, so first-boot/manual-repair/install/upgrade all become
  no-ops when the shipped build is current.

Result: fresh images ship a stamped build/, so a weak Pi never compiles on
boot or repair; an on-device rebuild happens only when an upgrade actually
changes app/.  build_app.sh never runs npm install, so repair.sh keeps its
offline guarantee.

* build_app.sh: rebuild when built output is incomplete, not just missing

Addresses review feedback: a matching stamp only proves the inputs are
unchanged, not that the output survived.  repair.sh exists to fix corruption,
so a build/ with index.html + stamp but a missing JS/CSS asset must still
rebuild.  Verify every file referenced by build/asset-manifest.json exists
(and that the manifest itself parses); rebuild otherwise.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 15:19:25 -06:00
..
build_app.sh Bake the app build into images; rebuild on-device only when stale (#536) 2026-07-15 15:19:25 -06:00
cleanup_orphaned_tags.py Creating script to clean up orphaned tag files. 2026-02-28 17:05:02 -07:00
delete_downloads.py Many fixes split out from the feature/unified-query branch. Installing diagnostic tools in the built images. Displaying video comment statistics. Echoing error when install.sh fails. 2024-04-14 13:13:30 -06:00
delete_similarly_named_videos.py Refactoring videos and archives UI paths for consistent scheme. 2026-03-20 15:38:32 -06:00
dev_build.sh Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
find_and_convert_srt_to_vtt.py Adding option to ignore errors in find_and_convert_srt_to_vtt.py. 2023-08-04 08:36:30 -06:00
find_and_rename_orphan_video_files.py Bumping version for new feature. 2022-12-07 18:15:28 -07:00
find_corrupt_videos.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
fix_media_permissions.sh File permissions fix script checks for exfat and other file systems before trying to repair, displays a warning and gives advice on how to fix the issue. 2026-03-05 18:18:53 -07:00
generate_certificates.sh Certificates: only include SANs permitted by the Root CA name constraints. 2026-07-05 12:38:08 -06:00
generate_subtitles.py Creating script which finds all SRT files and converts them to VTT. 2023-08-03 22:36:11 -06:00
install_debian_12.sh Caddy install: run gpg --dearmor with --batch --yes. 2026-07-05 13:03:11 -06:00
install_help_service.sh Replacing Tag names with escaped tag names to avoid errors in Tags Directory. 2024-10-16 18:56:10 -06:00
install_protomaps.sh Map search added to global search. Preview cards are displayed for all results in new Map tab. 2026-04-13 12:17:08 -06:00
install_raspberrypios.sh Caddy install: run gpg --dearmor with --batch --yes. 2026-07-05 13:03:11 -06:00
renew_certificates.sh Certificates: help.sh validates the CA and leaf certs; fix renew exec bit. 2026-07-09 16:00:43 -06:00
reset_api_db.sh Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
reset_tags.sh Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
reset_virtual_environments.sh Clearing cached python files in repair.sh. Creating reset_virtual_environments.sh script which deletes the virtual environments and rebuilds them (requires internet) 2026-02-28 16:11:12 -07:00
singlefile_browser_wrapper.sh Single file deno (#478) 2026-06-12 17:07:28 -06:00
singlefile_to_archive.py A Channel can be tagged with a single Tag. The Channel can be moved into a Tag Directory according to the config. 2024-10-16 18:56:19 -06:00
start_kiwix_serve.sh kiwix: drop --address 0.0.0.0 so kiwix-serve works on trixie. 2026-07-14 20:32:09 -06:00
upgrade.sh Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
upgrade_yt-dlp.sh Creating script which updates yt-dlp in the wrolpi venv to the latest available. 2025-01-23 17:46:37 -07:00
wrolpi-usb.sh Docs: recommend Raspberry Pi Imager instead of Etcher. 2026-07-03 18:58:54 -06:00