Repository navigation
Deploy tool: fewer writes to storage on installs and at each start - #344
Merged
Merged
Conversation
Packages are unpacked, prepared and checked in RAM when they fit (on storage otherwise); a package is written to the system partition once, from its file; a backup links a file an earlier backup or kept package holds; the provisioning fallback copy of main.js is built in RAM and written only when it changes, at installs and at each start; state files are written only when they change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertnisipeanu
force-pushed
the
emmc-deploy
branch
from
November 19, 2026 19:52
bb7798e to
3bf29b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cuts what an install and each start write to the head unit's storage, keeping one previous version for rollback, the safety and boot-loop guards, and write-then-rename for everything a power cut must not leave half written.
/run/mgu-deploy/stage-<pid>) when they fit: within 128 MiB for the run, a quarter of the memory available, and 64 MiB left free on/run, sized from the decompressed archive. Otherwise they unpack under/var/opt/mgu-deployas before. A tool's files are then written once intoversions/<v>.partialand renamed into place, as before.preinstalled_appsonce, straight from its file, in the same root-partition window (temp file, sync, rename, sync). The window's script and any staged data live in RAM.main.jsis built and patched in RAM, both at installs and in the boot unit, and written to/var/opt/mgu-deploy/main.jsonly when its bytes change.writeAtomicleaves a regular file that already holds the same bytes as it is (synced, mode set). A symlink or other non-regular file is still replaced by rename. The kept package is written only when its bytes differ.Update order: the boot unit and the scripts it runs keep their command lines, and any path to an artifact is accepted, so this works with the published updater, app-privacy and renderer.
AI: Claude Code, Claude Opus 5.5
Tested:
deploy/test/run.sh(Node 8.16.2): 1476/1476 pass, including new tests: unpacking on storage when RAM has no room, a backup linked to a kept package, and the backup keeping its bytes once that kept package is pruned. On an iDrive 7 test unit, measuring/var/optblock writes with the updater change (#345) installed: one tool update 23.5 → 9.2 MB, a Store update 70 → 28.6 MB (what remains is mostly MainApp's own unpack), Update all of six tools and three idrive7-apps apps 232 → 78.5 MB. Our writes at a start went from 2.3 MB to under 0.1 MB; the fallback copy was not rewritten. Hard power cuts (cache lost) mid-write of a tool's version folder, right after its version-folder swap, and during the Store's in-place update all recovered: the previous or the new version complete and current, services running, the next install finishing normally. Not tested on a car or an iDrive 8 unit.Human review: no
Screenshots: n/a
🤖 Generated with Claude Code