Repository navigation
Deploy headless-rust as a prebuilt .deb; remove legacy apps and scripts - #56
Merged
Merged
Conversation
Both desktop apps were superseded by headless-rust and are no longer built in CI. They remain available in the git history.
- diagnostics/ was written for the August Wi-Fi freeze investigation. Its fixes now live in setup-network.sh, and `diag:fix` wrote a second, conflicting sysctl file. - The updater slice, the window/updater RPC stubs and `setup:esptool` (an amd64 binary nothing used) came from the Electrobun app. - arduino/old/old.cpp is the 2023 prototype.
Cargo.toml becomes the single version source. It said 0.1.0 while package.json said 0.5.0 and rpc.rs hard-coded "0.5.0-rust", so there was no way to tell what a Pi was running. /api/health, getLocalVersion and the startup banner now report the version plus the commit passed in SPEEDCAMERA_GIT_SHA (set by package builds; local builds show "dev").
Both callers kept their own list of relative and /home/pi/... guesses. Look in /usr/lib/speedcamera, where the package installs the script, and fall back to the checkout copy for `cargo run`.
The packaged daemon runs as a system user without a password. Checking a typed password first would make shutdown fail whenever one was entered.
The fixed -L /usr/lib/aarch64-linux-gnu made the linker pick arm64 libraries whenever they are installed next to another architecture, as in the cross-compilation image. pkg-config already supplies the paths, and the fallback relies on the linker's defaults.
packaging/build-deb.sh cross-compiles in a Debian Bookworm container (podman or docker), so the Pi no longer needs Rust, Bun or internet to update. Building on Bookworm keeps the binary compatible with Trixie. The package runs the daemon as a dedicated `speedcamera` user, keeps data in /var/lib/speedcamera and ships a sudoers rule limited to the commands the daemon runs. Installed over a git-checkout setup, preinst and postinst stop the old unit and move ~/.speedcamera over; an aborted install restores the old service.
`scripts/pi.sh deploy|status|logs|uninstall` installs a locally built, released or given .deb over SSH. It also works over the offline hotspot, because the Pi only needs internet once, for the first install's dependencies. packaging/install.sh installs a release directly on a Pi. Removes the six old scripts and two unit files, which kept three diverging copies of the systemd unit and required building on the Pi.
The two spawn-and-check scripts duplicated their boilerplate and wrote test violations into the developer's real ~/.speedcamera; verify-ws.ts wasn't wired to anything. tests/server.test.ts covers the same HTTP, RPC and live-event checks against a throwaway data dir.
- The build job produces the arm64 package (uploaded as an artifact on every run) instead of an x86 binary nobody used. - Releases attach speedcamera_arm64.deb and SHA256SUMS next to the firmware, and a tag must match the Cargo.toml version. - The test job runs the integration suite, and the Rust cache now covers headless-rust/target (rust-cache was looking at ./target).
CI runs the build container as the runner's uid, which has no passwd entry in the image, and visudo refuses to run for such users. Validate the sudoers file in a separate root container (it only reads the file) and keep the build itself running as the calling user.
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.
Summary
The Pi no longer builds anything. The daemon ships as an arm64
.deb, cross-compiled in a Debian Bookworm container (locally or in CI), and one command installs or updates it over SSH. Updating works over the offline field hotspot too, since the Pi only needs internet once, for the first install's dependencies.What changes
headless-rust/packaging/):build-deb.shbuilds the.debwith cargo-deb in a Bookworm cross-compilation container (podman or docker). The binary needs glibc ≥ 2.34 and libaravis ≥ 0.8.26, so it runs on Bookworm and Trixie.speedcamerauser, with data in/var/lib/speedcameraand settings in/etc/default/speedcamera. A sudoers rule allows only the network script,nmcli,iwandshutdown -h now. This replaces the install-time polkit rule that gave every local user full NetworkManager control.~/.speedcamera(database and images) to/var/lib/speedcamera. If the install aborts, the old service is restored.apt removekeeps data;apt purgedeletes it.scripts/pi.sh(deploy / status / logs / uninstall) and an on-Pipackaging/install.shreplace six install/update/cleanup scripts and two unit files. Those had kept three diverging copies of the systemd unit.Cargo.toml(now 0.5.0) is the single version source./api/healthreportsversionandgitSha, and CI rejects a release tag that doesn't matchCargo.toml..deband uploads it as an artifact on every run. Releases attachspeedcamera_arm64.debandSHA256SUMSnext to the firmware. The test job runs the integration suite, and the Rust cache now actually coversheadless-rust/target.build.rshard-coded/usr/lib/aarch64-linux-gnu, which broke linking wherever arm64 libraries are installed alongside another architecture.electron/andelectronbun/.headless-rust/diagnostics/(the August Wi-Fi freeze investigation).setup:esptool.arduino/old/.tests/server.test.ts.Testing
cargo test: 14/14.bun run test:integration(new suite, against the mock daemon in a throwaway data dir): 10/10.bun tsc --noEmitis clean. Every commit that touches Rust compiles with-D warnings.apt installresolved all dependencies from Debian's repos. The service user was created, the sudoers file validated, and the packaged binary served the UI and/api/healthasspeedcamera.speedcamera.scripts/pi.sh deploy,statusanduninstall --purge --reset-networkwere run over SSH against that container.Before merging / rolling out
v0.5.0after merging. The current latest release (v0.4.0) has no.deb, so--releaseandinstall.shwon't work until then.~/.speedcamera.eth0to the camera LAN. That behaviour is unchanged, but it drops an Ethernet-only SSH session.Follow-ups (not in this PR)
cargo fmtand clippy cleanup (240 formatting diffs, ~50 clippy warnings), then add both as CI checks.setup-network.shwrites on every mode switch into the package..debwhile offline.cancelFlashis still a no-op.🤖 Generated with Claude Code