Repository navigation
package: add .deb build and apt install route (fixes #731; related: #784) - #833
pithead-reviewer[bot] merged 30 commits into
Conversation
scripts/build-deb.sh builds rigforge_<VERSION>_all.deb from the release
tarball using dpkg-deb. Package layout:
/usr/lib/rigforge/ — code tree (rigforge.sh, util/, systemd/,
docs/, images/, configs, docs)
/usr/bin/rigforge — wrapper exporting RIGFORGE_LIB and
RIGFORGE_STATE, execs rigforge.sh
/etc/rigforge/config.json — minimal config (conffile)
/var/lib/rigforge/ — state dir with .rigforge-package marker
/etc/apt/keyrings/rigforge.asc — signing key
DEBIAN/{control,postinst,postrm,conffiles} — dpkg metadata
postinst only runs daemon-reload, creates state dir, prints first-run
hint; it never compiles, tunes, edits GRUB, reboots or starts a miner.
postrm remove stops/disables units but keeps config and state (operator
data); purge removes everything.
DEBIAN/control Depends lists every package rigforge.sh installs today
(bash, jq, curl, nftables, git, build-essential, cmake, libuv1-dev,
libssl-dev, libhwloc-dev, gettext-base, python3, msr-tools).
.github/workflows/release.yml integrates the .deb build into the release
pipeline, adding it to the GitHub release assets.
tests/test-build-deb.sh validates input checks, build output, .deb
metadata, contents, wrapper env vars, DEBIAN scripts, and absence of
internal repo references.
docs/getting-started.md adds an apt install section with keyring
verification and apt sources setup.
|
FAIL What I investigatedThe PR description does not match the required three-section format. Reviewed head: What are the gaps
|
…ence - Add tests/test-build-deb.sh to Makefile test-suite target - Fix unused $PASS variable in test output line Co-Authored-By: Claude Code <noreply@anthropic.com>
- Remove unused RELEASE_DIR allocation in build-deb.sh (dead code) - Fix postinst first-install hint: check $2 (package arg) instead of config.json existence — config.json is always placed during build - Correct docs/getting-started.md: the package installs the wrapper, not systemd units (rigforge.sh setup installs units)
The test copied util/, systemd/, docs/, images/ into archive/ subdirs without creating those directories first, causing cp to fail in CI with 'No such file or directory'. Add mkdir -p for all subdirs.
…rigforge-as-a-deb-for-diy-instal
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e tarball Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…extract Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
FAIL What I investigatedReviewed PR #833 (head 2808fbc) against #731 and the slice it actually delivers, #784: scripts/build-deb.sh, tests/test-build-deb.sh, the release.yml step and the getting-started apt section, checked against rigforge.sh, util/package-mode.sh, packaging/ and apt-feed.yml on develop. CI is green and the lint, file budget and topology checks are clean. But the .deb would not work as a packaged install: the marker is in the wrong place, the wrapper's environment variables and the conffile are never read, every apt upgrade fails, it overwrites the user's apt signing key with a placeholder, it ignores the #785 postinst and upgrade unit, and remove leaves the miner running. The clean Ubuntu 24.04 install criterion is admitted unmet.
Reviewed head: What are the gaps
|
…de, remove and purge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pin the build epoch to the tag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d rendered units Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Blocked on #780 (with #781; implementation in PR #826). The package criterion of #784 needs the |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
PASS What I investigatedRe-reviewed PR #833 at head acab221 against #731 and the slice it delivers, #784, reading the diff ea1e0b1..acab221 (3 worker commits, 12 files; ea1e0b1 is in this clone). All three open findings are closed: the apt marker is found from the resolved script directory (bare-name and symlink runs now use /var/lib/rigforge, and the new cases go red with the fix reverted), prerm acts on remove only and only on units the package rendered (a git install's units get no call), and the conffile criterion is superseded by the architect's ruling of 2026-12-01 on #731, which the ADR, the body and the comments on #784 and #788 follow. CI is 27 pass and 1 skipping on the head, including the Ubuntu 24.04 .deb install run. Not checked: nothing ran against real systemd or dpkg (none on this Mac, none in CI), so the exit codes of 'systemctl stop' and 'disable --now' on a live host remain unproven, as the earlier note F833-18 and the body's shortcut already record.
Reviewed head: |
Owner brief for
|
…rigforge-as-a-deb-for-diy-instal
…le budget rigforge.sh now sources util/layout.sh from its own directory for the apt layout default and the RIGFORGE_LIB/RIGFORGE_STATE validation, so the merge with develop stays at the 6028-line ceiling. The lines move unchanged and the new file joins the kcov include list. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t the file budget" Loading util/layout.sh from the script's directory ran code from there before the RIGFORGE_LIB checks whenever RIGFORGE_LIB pointed at another tree. The layout default and the two checks go back inline, unchanged. This reverts commit ffb7c04. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… the file budget Merged with develop, rigforge.sh was 6033 lines against its 6028 ceiling. The config install helper moves unchanged beside the other config-apply helpers, and the comments in the edited hunk go, leaving rigforge.sh at 6024. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
PASS What I investigatedRe-reviewed PR #833 at head 358ac46 against #731 and the slice it delivers, #784, reading the diff ea1e0b1..358ac46 (ea1e0b1 is in this clone; worker commits 710b3d2, 943def8, acab221, ffb7c04, ba46560, 358ac46, plus one merge of develop). The three earlier blockers are fixed and I reproduced each fix with a revert going red; the merge of develop is byte-identical to a mechanical merge, the file-budget commit is a byte-identical move of _config_replace into a file rigforge.sh already sources at startup, and CI is 27 pass and 1 skipping on the head, first attempt. Not checked: nothing ran against real systemd or dpkg (none on this Mac, none in CI), so the exit codes of 'systemctl stop' and 'disable --now' on a live host and setup or upgrade under the apt layout stay unproven, as the body's shortcut and the earlier note F833-18 already record.
Reviewed head: |
Owner brief for
|
What's the problem
Closes #731
Debian and Ubuntu DIY operators have no package install. This PR delivers #784 (Related: #784): a checksummed
.debbuilt from the release bundle and attached to each release. It is the package that the apt feed (#786) and the safe apt upgrade (#785) already expect.How I fixed it
scripts/build-deb.sh <bundle> <tag>buildsrigforge_<VERSION>_all.debfrom release.yml's tarball. It fails when VERSION disagrees with the tag. The build is byte-reproducible: mtimes come fromSOURCE_DATE_EPOCH, which release.yml sets from the tag commit.Layout:
/usr/lib/rigforge, withoutdocs/dev, with group/world write and setid bits stripped. Theaptmarker sits there./usr/bin/rigforgeruns it withRIGFORGE_LIB=/usr/lib/rigforgeandRIGFORGE_STATE=/var/lib/rigforge, now that Add RIGFORGE_STATE for config and state files, default unchanged #780/Resolve every code lookup from one lib dir so the code tree can be read-only #781 have merged.rigforge-upgrade.serviceis installed, andDependscovers everything setup installs.An apt-marked tree with no
RIGFORGE_STATEuses the same layout. Running/usr/lib/rigforge/rigforge.shdirectly, which is what rigforge's own$0hints tell the operator to do, therefore never writes state into the code tree.Decisions taken:
config.jsonis state under/var/lib/rigforge.setupcreates it and purge removes it. There is no shipped conffile and no/etc/rigforge/config.json. This is the operator's ruling of 2026-12-01 and supersedes the conffile line in Build a .deb from the release bundle and attach it to each release (refines #731) #784's Contents and the/etc/rigforgeassertions in Verify both routes from the real channel on each release, including behind Tor #788. The reasons: since Add RIGFORGE_STATE for config and state files, default unchanged #780config.jsonlives inRIGFORGE_STATE, and setup's wizard keys on its absence. A shipped file would make the Run apt upgrades safely: postinst queues a one-shot upgrade outside dpkg #785 postinst treat never-configured hosts as configured, and dpkg would prompt on every upgrade. ADR 0003's purge line now says purge deletes/var/lib/rigforge(config included) and any/etc/rigforgethe package owns, and never reverts tuning.Maintainer scripts, all from
packaging/debian/:prermstops and disables every RigForge unit on remove, before dpkg deletes the code. It fails if a unit that exists cannot stop.postrmexits 0 for every dpkg action.postrmdeletes/var/lib/rigforge. It also deletes the units, timers and paths, the firewall rules and the control state, but only those it can prove the package rendered (a service that references the package paths). A git install's files survive. Purge never touches tuning.release.yml adds the
.debtoSHA256SUMSand the draft assets. The CI e2e job gains the gated stepassert: deb install pass, and both new suites are intests/manifest.json.Shortcut:
setup,upgradeandpackage-upgradeare not executed under the package layout in CI, because the container has no systemd. Upgrade when a systemd-capable e2e exists.File budget: merged with
develop(34d9ea5),rigforge.shwas 6033 lines against its 6028 ceiling.358ac46moves_config_replaceunchanged intoutil/config-apply-state.shand drops the comments in that hunk, leavingrigforge.shat 6024. The apt layout lines stay inline, before theRIGFORGE_LIBchecks. A first attempt (ffb7c04) moved those lines into a newutil/file and is reverted (ba46560), because that file would have been loaded from the script's directory before the checks.Round-4 review fixes in
710b3d2and943def8:/var/lib/rigforge;tests/test-package-mode.shcovers both forms.prermacts only onremove. It stops only units the package rendered (same ownership rule aspostrm), usesdisable --nowonly for units with an[Install]section and plainstopfor the static ones. A git install's units are left alone, whichtests/test-package-upgrade.shcovers.postinstusesmkdir -p ... || truefor the state dir.Recommends: linux-tools-generic | linux-cpupowercovers cpupower.build-deb.shtakes only the tarball and uses a plain trap; a build test asserts that prerm and postrm share one unit list.docs/devis not shipped.Here is the proof
Head
358ac46(basedevelopataff3464merged in):gh pr checks 833shows all 27 checks passing, including Lint, Test suite, Coverage and End-to-end, andWorkflow audit issueis skipped. On that headFILE_BUDGET_REQUIRE_BASE=1 bash scripts/lint-file-budget.shprintsfile budget OK,shellcheck --severity=warning $(git ls-files "*.sh")andshfmt -i 4 -d $(git ls-files "*.sh")exit 0, andbash tests/test-config-write-safety.sh,tests/test-tune-gate.sh,tests/test-state-lib.shandtests/test-coverage-cache.shpass locally. The first lines ofrigforge.sh, through the last startupsource, are identical to the merge commit's.At
acab221the Test suite log showsan apt-marked tree run by bare name uses the package layout,... run by symlink name ...,package upgrade: all checks passed,ok: prerm and postrm act on the same unit listandbuild-deb: all checks passed. Lint failed three times on710b3d2: two runner shutdowns and one stall. The cause was a literalsource rigforge.shin the new test, which made shellcheck inline the whole script; a combined local run took 244 s and raised 35 run.sh warnings.943def8passes the name through a variable.shellcheck --severity=warning $(git ls-files "*.sh")now exits 0 locally.At
92ee84a,End-to-end (Docker)passed. Itstests/test-deb-install.shrun onubuntu:24.04covered:rigforge --version;/var/lib/rigforge, and via a direct/usr/lib/rigforge/rigforge.shrun;nothing was written under /usr/lib/rigforge;The two failures on that head were fixed afterwards:
api-refresh starts a bounded number of programs (#818): the layout check now uses builtins.bash tests/test-api-refresh-spawns.sh rigforge.shgives 99 passed locally.tests/test-package-mode.sh.Other checks I ran:
bash tests/test-package-upgrade.sh, under both bash and dash: every maintainer-script case passes. The 11watchdog enabled/disabledreal-upgrade cases fail only on this Mac, and develop's own copy of the test fails them the same way.purge keeps every unit and the control state of a non-package installred.bash tests/manifest-selftest.sh: 8 passed.bash tests/test-workflow-contract.sh: ok.shellcheck --severity=warningandshfmt -i 4 -don the changed scripts: clean.bash scripts/lint-topology-classes.sh: OK.Reviews:
ffb7c04ordering; on358ac46both report no findings, with the moved function byte-identical and all of its statements executed bytests/test-config-write-safety.sh.No bench job was run, because the worker-to-Pithead contract is unchanged.
build-deb.shbuildsrigforge_<VERSION>_all.debreproducibly and fails when VERSION disagrees/usr/lib/rigforge, a wrapper exportingRIGFORGE_LIB/RIGFORGE_STATE, state in/var/lib/rigforge, theaptmarker and full Depends. Config is state, not a conffile, per the ruling under Decisions taken..debtoSHA256SUMSin the draft release--versionand doctor pass, then upgrade, remove and purge leave the stated residue🤖 Generated with Claude Code