Repository navigation
feat(rust): make the release binary self-contained - #6
Merged
Merged
Conversation
The bare release binary failed on a first run: it needed install.conf.example and vendor/tar1090-install.sh next to it, and someone who downloads only the .bin has neither. Compile both in from the repo files with include_str! and include_bytes!, so there is no second copy in the sources. The files next to the binary still win, which keeps the archive layout and the shell version's behavior unchanged. The pin is checked against the compiled-in bytes through sha256sum on stdin, so a dry-run still writes nothing; a real run writes the installer to ~/.cache/easy1090 before running it.
vendor/ and install.conf.example are compiled into the binary now, so a change to either has to rebuild and test it, in particular the check that the embedded installer still matches its pin.
The READMEs, the changelog and the Makefile comment said the bare .bin cannot complete an install. It can now, since it carries the example config and the pinned tar1090 installer; the copies from the archive still take precedence. Candidates up to v0.2.0-rust.2-rc predate this and keep needing the archive, so the install example stays on the archive until the next candidate.
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.
Why
The bare
.binpublished on the release could not complete an install. It readinstall.conf.exampleandvendor/tar1090-install.shfrom its working directory, and someone who downloads only the.binhas neither. A first run stopped withExample config not found, and with a hand-madeinstall.confit stopped at the tar1090 step, after the earlier steps had already run.What changes
rust/src/core/cfg.rs:install.conf.exampleis compiled in withinclude_str!. The file next to the binary still wins; without it, the first run createsinstall.conffrom the compiled-in copy, and a dry-run reads that copy.rust/src/steps/tar1090.rs: the pinned installer is compiled in withinclude_bytes!, pointing at the samevendor/tar1090-install.shthe repo already tracks, so there is no second copy in the sources.sha256sumon stdin, so a dry-run still writes nothing.vendor/next to the binary writes the script to~/.cache/easy1090/tar1090-install.sh(removed byuninstall) and runs it withsudo bash.rust/tests/standalone.rsand unit tests: the binary runs in an empty directory, and a test fails if the embedded installer stops matchingTAR1090_INSTALLER_SHA256in the embedded example, so updatingvendor/without the pin breaks the build..github/workflows/rust.yml: the job also runs for changes tovendor/**andinstall.conf.example, which are now part of the binary..bincannot install.Verification
cargo fmt --check,clippy -D warningsandcargo testpass: 103 tests, 1 ignored (the sudo TTY test)..binalone, with no config, example orvendor/: 36 of 36 identical to the shell version in dry-run. The only difference is the installer path,~/.cache/easy1090/tar1090-install.shinstead of<root>/vendor/.....bincreatedinstall.confand ranfeed --status.sudo bashof the cached installer, which needs a full install. Writing the file is unit tested, and the command is the same one thevendor/path runs.Notes
v0.2.0-rust.2-rcbinaries predate this change, so the README install example keeps using the archive until the next candidate is cut..binalone does not carryLICENSE.tar1090, which ships in the archive'svendor/. Worth deciding whether the binary should print the notice.