| 1 |
// magicmirror: Linux release recipe for Bento (aarch64 on astra). |
| 2 |
// |
| 3 |
// Ends at `deploy`, not `collect`: magicmirror installs itself rather than |
| 4 |
// handing off to Sando. That is a judgement about blast radius, not a house |
| 5 |
// style -- a bad deploy here blanks a monitoring panel on a console. The |
| 6 |
// cheapest rung, honestly taken. See wiki `deploy-ceremony-tiers`. |
| 7 |
// |
| 8 |
// No host is named anywhere in here: build_host() resolves to whichever native |
| 9 |
// machine the topology assigns aarch64, and deploy() to whichever machine |
| 10 |
// bento.toml says runs it. They happen to be the same box; the recipe should |
| 11 |
// not know that. |
| 12 |
|
| 13 |
let h = build_host(); |
| 14 |
let v = version(); |
| 15 |
let r = repo(); |
| 16 |
|
| 17 |
step("checkout"); |
| 18 |
let sha = checkout_sha(h); |
| 19 |
log("pinned " + h + " to magicmirror-v" + v + " @ " + sha); |
| 20 |
|
| 21 |
step("prebuild"); |
| 22 |
sh_ok(h, "cd " + r + " && cargo clippy --all-targets " + feature_flags() + " -- -D warnings"); |
| 23 |
sh_ok(h, "cd " + r + " && cargo test " + feature_flags()); |
| 24 |
|
| 25 |
step("build"); |
| 26 |
sh_ok(h, "cd " + r + " && cargo build --release " + feature_flags()); |
| 27 |
let binary = resolve_artifact(h, r + "/target/release/magicmirror"); |
| 28 |
|
| 29 |
step("verify"); |
| 30 |
log(glibc_check(binary)); |
| 31 |
|
| 32 |
// The version about to ship is the version in the tag. This assertion is the |
| 33 |
// reason `--version` exists on this binary at all: it was added 2026-08-23 with |
| 34 |
// this recipe, and before it the only way to ask a running magicmirror what it |
| 35 |
// was was to stat the file. |
| 36 |
sh_ok(h, binary + " --version | grep -qw " + v); |
| 37 |
|
| 38 |
step("deploy"); |
| 39 |
// Stages under /var/tmp/bento-deploy/magicmirror/ and calls the privileged |
| 40 |
// installer, which keeps the outgoing binary as <dst>.prev, installs |
| 41 |
// atomically, and restarts the unit. |
| 42 |
log(deploy(binary)); |
| 43 |
|
| 44 |
// Health assertions live inside the deploy step rather than a step of their |
| 45 |
// own: a "health" step would abort the run AFTER the install has happened, |
| 46 |
// leaving the binary live and the release reading failed. |
| 47 |
// |
| 48 |
// This is a TUI on a console, so there is no port to probe. The unit being |
| 49 |
// active is the whole of what "up" means here -- and it is not a formality: the |
| 50 |
// binary reads only ~/.config/magicmirror/ with no fallback to the old |
| 51 |
// ops-viewer path, so a config that did not move with a rename is exactly the |
| 52 |
// failure that leaves the unit dead and the screen dark. |
| 53 |
sh_ok(deploy_host(), "test -x " + install_path()); |
| 54 |
sh_ok(deploy_host(), "systemctl is-active --quiet magicmirror-panel.service"); |
| 55 |
|
| 56 |
log("magicmirror " + v + " (" + target() + ") built on " + h + " and live on " + deploy_host()); |
| 57 |
|