Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3ca54fd
package: add .deb build and apt install route (fixes #731, #784)
Nov 24, 2026
e63102c
fix: replace real email with placeholder for topology linter
Nov 24, 2026
941cd8c
test: register test-build-deb.sh in test-suite; fix stray $PASS refer…
Nov 24, 2026
b56e6ae
fix: clean up build-deb.sh and fix docs claim about systemd units
Nov 24, 2026
cd8a08b
fix: create archive subdirs in test-build-deb.sh
Nov 24, 2026
e6d3707
Merge remote-tracking branch 'origin/develop' into agent/731-package-…
Nov 24, 2026
7ff0fb3
fix: copy directories recursively in test-build-deb.sh
Nov 24, 2026
fa735c9
fix: nest the test bundle under a top-level directory like the releas…
Nov 24, 2026
08f9cb6
fix: build the test deb in a scratch dir and inspect DEBIAN with raw-…
Nov 24, 2026
2808fbc
fix: select xz compression with -Zxz; dpkg-deb has no --zstd option
Nov 24, 2026
ff69003
package: build the .deb from packaging/debian and test install, upgra…
Nov 24, 2026
151d3e8
package: fail removal when a unit cannot stop, purge rendered units, …
Nov 25, 2026
f9747ff
package: strip group/world write and setid bits, purge only the liste…
Nov 25, 2026
18efc35
Merge origin/develop into agent/731-package-rigforge-as-a-deb-for-diy…
Nov 25, 2026
1aac9a1
Merge origin/develop into agent/731-package-rigforge-as-a-deb-for-diy…
Dec 1, 2026
dfc2307
package: run the code read-only from /usr/lib/rigforge with state in …
Dec 1, 2026
f5f0747
package: apt tree defaults to the package layout, purge removes every…
Dec 1, 2026
b144e6b
package: purge only units, firewall rules and control state the packa…
Dec 1, 2026
92ee84a
package: purge the firewall rules the miner unit loads; fix test fixt…
Dec 1, 2026
35f8e2e
rigforge.sh: detect the apt layout with builtins so api-refresh spawn…
Dec 1, 2026
6a051b2
rigforge.sh: shfmt the apt layout detection
Dec 1, 2026
9df34dc
test: cover the apt layout default; list the package suites in the te…
Dec 1, 2026
ea1e0b1
test: check the apt layout default in-shell so it also runs under kcov
Dec 1, 2026
710b3d2
package: find the apt marker from the resolved script dir; prerm acts…
Dec 1, 2026
943def8
test: keep the bare-name layout case opaque to shellcheck's source in…
Dec 1, 2026
acab221
docs: ADR 0003 purge line follows the config-as-state ruling
Dec 1, 2026
34d9ea5
Merge remote-tracking branch 'origin/develop' into agent/731-package-…
Dec 1, 2026
ffb7c04
refactor: move the layout bootstrap into util/layout.sh to fit the fi…
Dec 1, 2026
ba46560
Revert "refactor: move the layout bootstrap into util/layout.sh to fi…
Dec 1, 2026
358ac46
refactor: move _config_replace into util/config-apply-state.sh to fit…
Dec 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ jobs:
id: assert_isolation
if: ${{ !cancelled() }}
run: bash tests/e2e/linux.sh isolation
- name: "assert: deb install pass"
id: assert_deb_install
if: ${{ !cancelled() }}
run: bash tests/test-deb-install.sh
- name: "setup: Build the API allowlist kernel test image"
id: setup_allowlist_image
if: ${{ !cancelled() }}
Expand All @@ -262,13 +266,15 @@ jobs:
APPLIANCE: ${{ steps.assert_appliance.outcome }}
ISOLATION: ${{ steps.assert_isolation.outcome }}
ALLOWLIST: ${{ steps.assert_allowlist.outcome }}
run: bash scripts/require-success.sh "deploy=$DEPLOY" "appliance=$APPLIANCE" "isolation=$ISOLATION" "allowlist=$ALLOWLIST"
DEB_INSTALL: ${{ steps.assert_deb_install.outcome }}
run: bash scripts/require-success.sh "deploy=$DEPLOY" "appliance=$APPLIANCE" "isolation=$ISOLATION" "allowlist=$ALLOWLIST" "deb-install=$DEB_INSTALL"
- name: "assert: categorize outcome"
id: assert_categorize
if: always()
env:
CAT_ASSERT_ALLOWLIST: ${{ steps.assert_allowlist.outcome }}
CAT_ASSERT_APPLIANCE: ${{ steps.assert_appliance.outcome }}
CAT_ASSERT_DEB_INSTALL: ${{ steps.assert_deb_install.outcome }}
CAT_ASSERT_DEPLOY: ${{ steps.assert_deploy.outcome }}
CAT_ASSERT_DOCKER_MODES: ${{ steps.assert_docker_modes.outcome }}
CAT_ASSERT_ISOLATION: ${{ steps.assert_isolation.outcome }}
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ jobs:
bash scripts/build-release-bundle.sh "$TAG" relbin/rigforge-"$TAG"-*-unknown-linux-musl
bash scripts/build-homebrew-formula.sh "$TAG" SHA256SUMS rigforge.rb "rigforge-$TAG.tar.gz"

- name: Build the .deb package
run: |
set -euo pipefail
deb=$(SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) bash scripts/build-deb.sh "rigforge-$TAG.tar.gz" "$TAG")
sha256sum "$deb" >> SHA256SUMS
echo "--- SHA256SUMS (with .deb) ---"; cat SHA256SUMS

- name: Extract release notes from CHANGELOG.md
run: |
set -euo pipefail
Expand All @@ -151,12 +158,7 @@ jobs:
# Mark 0.x tags as pre-releases.
pre=""
case "${TAG#v}" in 0.*) pre="--prerelease" ;; esac
# Create the release as a DRAFT so a human reviews the generated notes + bundles and clicks
# "Publish" — a deliberate gate for a tool that installs a root miner. Drop --draft here to
# go back to publishing automatically on tag push.
# Checksums only, by decision (2026-07-11): release signing was removed — see
# SECURITY.md > Release integrity. SHA256SUMS proves the bundle matches what CI built.
assets=("rigforge-$TAG.zip" "rigforge-$TAG.tar.gz" SHA256SUMS rigforge.rb)
assets=("rigforge-$TAG.zip" "rigforge-$TAG.tar.gz" "rigforge_${TAG#v}_all.deb" SHA256SUMS rigforge.rb)
for binary in relbin/rigforge-"$TAG"-*-unknown-linux-musl; do
[ -e "$binary" ] && assets+=("$binary")
done
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ test-suite: ## rigforge test suite: unit + black-box, every CPU/OS profile simul
bash tests/test-release-bundle.sh
bash tests/test-env-override-gate.sh
python3 tests/test-server-deadline.py
bash tests/test-build-deb.sh

test-e2e: ## Full end-to-end run in disposable Linux containers (needs Docker)
bash tests/e2e/linux.sh
bash tests/test-deb-install.sh

e2e-docs-replay: ## Replay documented setup and two reboots in an explicitly supplied disposable KVM guest
python3 tests/docs_replay.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Git-clone and appliance installs keep today's behaviour unchanged, with no marke
- An apt upgrade of an already-configured host queues the real upgrade **outside dpkg**: postinst writes an upgrade-pending marker under `/var/lib/rigforge` and starts the one-shot `rigforge upgrade` unit via `systemctl start --no-block` (#785). A first install (no config) is inert.
- The miner **restarts automatically, but only after a successful upgrade** (owner, 2026-11-20). On failure the previous build keeps running, the marker and failure stay visible in `status`/`doctor`, postinst still exits 0 so dpkg never half-configures the package, and retry is one documented `rigforge upgrade` command. `apt-mark hold` defers.
- `brew upgrade` never restarts a running miner — it prints a hint; the auto-restart ruling applies to apt only (#787).
- **Purge** removes `/etc/rigforge` and `/var/lib/rigforge` but **never reverts system tuning** — not GRUB, hugepages, MSR or sysctl. Only `rigforge uninstall` undoes tuning (#784). Remove keeps config and state.
- **Purge** deletes `/var/lib/rigforge` (`config.json` included; since #780 it is state that `setup` creates, never a shipped conffile) and any `/etc/rigforge` directory the package owns, and **never reverts system tuning** — not GRUB, hugepages, MSR or sysctl. Only `rigforge uninstall` undoes tuning (#784). Remove keeps config and state.

### D3. Signing-key custody (owner, 2026-11-20 — supersedes pithead #3459)

Expand Down
18 changes: 18 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ so run `rigforge backup` before and `rigforge restore` after. Brew cannot do the
HugePages, MSR): on Linux, that is `rigforge setup`'s job, and Linuxbrew's user-owned prefix is not a
safe place for code that root-run units execute, so prefer the git route below on a Linux rig.

### Install with apt (Debian / Ubuntu on Linux)

The apt steps (signing key, source entry, `apt install rigforge`) are in the
[README](../README.md), under **Prefer `apt`?**. Installing changes nothing on the host: the
package puts the release bundle (without the developer notes under `docs/dev`) in the root-owned
`/usr/lib/rigforge`, adds the one-shot upgrade unit, and installs a `/usr/bin/rigforge` that runs
it with `RIGFORGE_LIB=/usr/lib/rigforge` and `RIGFORGE_STATE=/var/lib/rigforge`
([where files live](operations.md#where-files-live)). Provision with `sudo rigforge setup`, which
creates `config.json`, the XMRig build and every other piece of state under `/var/lib/rigforge`;
that directory is root's, so run `backup` and `restore` with `sudo` too.

`apt upgrade rigforge` on a configured host queues the
[package upgrade](operations.md#upgrading-through-apt). `apt remove` stops and disables the units `setup` rendered for the package (never those of a git install)
and keeps `/var/lib/rigforge`. `apt purge` also deletes it, the control state under
`/var/lib/rigforge-control*`, every unit, timer and path `setup` rendered, the API firewall rules
file and the logrotate rule. Neither reverts system tuning (GRUB, HugePages, MSR, fstab, limits);
that is `rigforge uninstall`, run before `apt purge`.

---

## 2. Get the code
Expand Down
2 changes: 2 additions & 0 deletions docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ RigForge reads code from one directory and writes state to another. Both default
| `RIGFORGE_LIB` | the directory of `rigforge.sh` | `rigforge.sh`, `util/` scripts, `systemd/` unit templates, `VERSION`, `RIGFORGE_REF`, the `.rigforge-package` marker. Never written by a worker command, so it can be root-owned and read-only. |
| `RIGFORGE_STATE` | the same directory (`RIGFORGE_HOME` when set) | `config.json`, the `.rigforge-*` markers and sidecars (appliance marker, config provenance, revision key), `config-backups/`, `backups/`, support tarballs and the default worker root `data/worker`. |

The apt package runs `rigforge.sh` with `RIGFORGE_LIB=/usr/lib/rigforge` and `RIGFORGE_STATE=/var/lib/rigforge`. A tree whose `.rigforge-package` marker reads `apt` uses those values whenever `RIGFORGE_STATE` is unset, so running `/usr/lib/rigforge/rigforge.sh` directly behaves like `rigforge`. There is no `/etc/rigforge`: `config.json` is state that `setup` creates, not a dpkg conffile, so the first-run wizard still runs on a fresh install and upgrades never prompt about it.

`RIGFORGE_HOME` is the older sandbox override: it sets the state directory and the template, `VERSION` and `proposed-grub.sh` lookups, while the `util/` scripts still come from the directory of `rigforge.sh`. Set `RIGFORGE_LIB` and `RIGFORGE_STATE` instead; each wins over it. Rendered units take `ExecStart` and the server script from the lib directory and the `config.json` credential from the state directory. When either variable is set, the miner unit and the scheduled verb units (autotune, watchdog, api-refresh, control-apply, control-upgrade) and the shared-host runner carry it in their environment. Both values must be clean absolute paths (letters, digits, `.`, `_`, `-`, `/`), and as root `RIGFORGE_LIB` must be owned by root and not group- or world-writable; otherwise `rigforge.sh` refuses to start. The `upgrade` verb updates a git checkout in place, so it still needs a writable checkout.

## Backup & restore
Expand Down
13 changes: 13 additions & 0 deletions packaging/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Package: rigforge
Version: @VERSION@
Section: net
Priority: optional
Architecture: all
Recommends: linux-tools-generic | linux-cpupower
Depends: bash, jq, curl, nftables, git, build-essential, cmake, libuv1-dev, libssl-dev, libhwloc-dev, gettext-base, python3, msr-tools, linux-tools-common | linux-cpupower
Maintainer: RigForge maintainers <maintainers@rigforge.invalid>
Homepage: https://github.com/p2pool-starter-stack/rigforge
Description: Provision and run a tuned XMRig worker for RandomX mining
RigForge provisions and runs an XMRig worker for a Pithead coordinator,
any RandomX Stratum pool, or a solo daemon pool. Installing changes
nothing on the host; run "sudo rigforge setup" to provision.
11 changes: 8 additions & 3 deletions packaging/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ set -e

ROOT=${RIGFORGE_PKG_ROOT:-}
STATE=$ROOT/var/lib/rigforge
CONFIG=$ROOT/etc/rigforge/config.json
CONFIG=$STATE/config.json
RETRY='sudo rigforge upgrade'

case "$1" in
configure)
old=$2
mkdir -p "$STATE" || true
if [ -d "$ROOT/run/systemd/system" ]; then systemctl daemon-reload || true; fi
if [ -z "$old" ]; then
echo "rigforge: installed; nothing on this host changed. Provision with: sudo rigforge setup"
fi
new=$(dpkg-query -W -f '${Version}' rigforge 2>/dev/null || true)
if [ -n "$old" ] && [ -n "$new" ] && [ -f "$CONFIG" ] && dpkg --compare-versions "$new" gt "$old"; then
if install -d -m 0755 "$STATE" && tmp=$(mktemp "$STATE/.upgrade-pending.XXXXXX") && chmod 0644 "$tmp" && printf '%s\n' "$new" >"$tmp" && mv -f "$tmp" "$STATE/upgrade-pending"; then
if [ -d "$ROOT/run/systemd/system" ] && systemctl daemon-reload && systemctl start --no-block rigforge-upgrade.service; then
if tmp=$(mktemp "$STATE/.upgrade-pending.XXXXXX") && chmod 0644 "$tmp" && printf '%s\n' "$new" >"$tmp" && mv -f "$tmp" "$STATE/upgrade-pending"; then
if [ -d "$ROOT/run/systemd/system" ] && systemctl start --no-block rigforge-upgrade.service; then
echo "rigforge: upgrade to $new queued outside dpkg; follow it with: journalctl -u rigforge-upgrade"
else
echo "rigforge: could not start the upgrade unit; run: $RETRY" >&2
Expand Down
29 changes: 29 additions & 0 deletions packaging/debian/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
set -e

ROOT=${RIGFORGE_PKG_ROOT:-}
UNITS="xmrig.service rigforge-upgrade.service rigforge-autotune.timer rigforge-autotune.service rigforge-watchdog.timer rigforge-watchdog.service rigforge-api.service rigforge-api-refresh.timer rigforge-api-refresh.service rigforge-control.service rigforge-control-apply.path rigforge-control-apply.service rigforge-control-upgrade.path rigforge-control-upgrade.service"

case "$1" in
purge)
U=$ROOT/etc/systemd/system
ours() { grep -Eqs '/usr/lib/rigforge/|RIGFORGE_STATE=/var/lib/rigforge$' "$U/$1"; }
drop=""
for unit in $UNITS; do
case "$unit" in *.timer | *.path) svc=${unit%.*}.service ;; *) svc=$unit ;; esac
if ours "$svc"; then drop="$drop $unit"; fi
done
if ours xmrig.service || ours rigforge-api.service || ours rigforge-control.service; then drop="$drop rigforge-api-firewall.nft"; fi
if ours rigforge-control.service; then rm -rf "$ROOT/var/lib/rigforge-control" "$ROOT/var/lib/rigforge-control-upgrade"; fi
for unit in $drop; do rm -f "$U/$unit"; done
if grep -qs /var/lib/rigforge/ "$ROOT/etc/logrotate.d/xmrig"; then rm -f "$ROOT/etc/logrotate.d/xmrig"; fi
if [ "$(cat "$ROOT/etc/rigforge-root-guard" 2>/dev/null)" = "allow /usr/lib/rigforge" ]; then rm -f "$ROOT/etc/rigforge-root-guard"; fi
rm -rf "$ROOT/var/lib/rigforge"
if [ -d "$ROOT/run/systemd/system" ]; then systemctl daemon-reload || true; fi
;;
remove)
if [ -d "$ROOT/run/systemd/system" ]; then systemctl daemon-reload || true; fi
;;
esac

exit 0
21 changes: 21 additions & 0 deletions packaging/debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
set -e

ROOT=${RIGFORGE_PKG_ROOT:-}
UNITS="xmrig.service rigforge-upgrade.service rigforge-autotune.timer rigforge-autotune.service rigforge-watchdog.timer rigforge-watchdog.service rigforge-api.service rigforge-api-refresh.timer rigforge-api-refresh.service rigforge-control.service rigforge-control-apply.path rigforge-control-apply.service rigforge-control-upgrade.path rigforge-control-upgrade.service"

case "$1" in
remove)
U=$ROOT/etc/systemd/system
if [ -d "$ROOT/run/systemd/system" ]; then
systemctl stop rigforge-upgrade.service
for unit in $UNITS; do
case "$unit" in *.timer | *.path) svc=${unit%.*}.service ;; *) svc=$unit ;; esac
grep -Eqs '/usr/lib/rigforge/|RIGFORGE_STATE=/var/lib/rigforge$' "$U/$svc" || continue
if grep -qs '^\[Install\]' "$U/$unit"; then systemctl disable --now "$unit"; else systemctl stop "$unit"; fi
done
fi
;;
esac

exit 0
3 changes: 3 additions & 0 deletions packaging/debian/rigforge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export RIGFORGE_LIB=/usr/lib/rigforge RIGFORGE_STATE=/var/lib/rigforge
exec /usr/lib/rigforge/rigforge.sh "$@"
16 changes: 6 additions & 10 deletions rigforge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ _script_dir() {
case "$src" in */*) d="${src%/*}" ;; *) d=. ;; esac
cd -P "${d:-/}" &>/dev/null && pwd
}
_pkg_marker="${RIGFORGE_PACKAGE_MARKER:-$(_script_dir)/.rigforge-package}"
[ -n "${RIGFORGE_STATE:-}" ] || [ ! -f "$_pkg_marker" ] || {
read -r _pkg_marker <"$_pkg_marker" || :
[ "$_pkg_marker" != apt ] || export RIGFORGE_LIB="${RIGFORGE_LIB:-$(_script_dir)}" RIGFORGE_STATE=/var/lib/rigforge
}
for _v in RIGFORGE_LIB RIGFORGE_STATE; do [ -z "${!_v:-}" ] || [[ ${!_v} =~ ^/[A-Za-z0-9._/-]+$ ]] || exit "$(echo "rigforge: $_v must be a clean absolute path" >&2 && echo 1)"; done
[ -z "${RIGFORGE_LIB:-}" ] || [ "$(id -u)" != 0 ] || [ -z "$(find -H "$RIGFORGE_LIB" -maxdepth 0 \( ! -user root -o -perm -020 -o -perm -002 \) 2>/dev/null)" ] || exit "$(echo "rigforge: RIGFORGE_LIB must be root-owned and not group/world-writable" >&2 && echo 1)"
[ "${RIGFORGE_TEST_OVERRIDES:-0}" = 1 ] || unset XMRIG_VERSION XMRIG_COMMIT API_CMD DMIDECODE RDMSR_BIN SERVICE_NAME LOGROTATE_DIR GRUB_DEFAULT FSTAB LIMITS_CONF MODULES_LOAD_DIR MODULES_FILE SYSTEMD_DIR HUGEPAGES_1G_DIR BIN_DIR MEMINFO CPUINFO MSR_MODULE_DIR GOVERNOR_FILE HUGEPAGES_1G_NR NR_HUGEPAGES_FILE CPUFREQ_MAX CPU_SYSFS DMI_DIR SMT_CONTROL LOCKDOWN_FILE RIGFORGE_APPLIANCE_MARKER RIGFORGE_LEGACY_APPLIANCE_UNIT
Expand Down Expand Up @@ -4078,16 +4083,7 @@ for path in sys.argv[1:]:
PY
}

_config_replace() {
local tmp="$CONFIG_JSON.new.$$"
(umask 077 && cp "$1" "$tmp") && chmod 600 "$tmp" && mv -f "$tmp" "$CONFIG_JSON" && return 0
rm -f "$tmp"
return 1
}
# Merge an allowlisted, parse-valid staged change into config.json after snapshotting the old one.
# rc 0 = committed, 1 = invalid/rejected, 2 = install failed with old config restored, and 3 =
# storage failed after rename and recovery is uncertain. The caller records the matching terminal.
_control_commit() { # <staged.json> <backups-dir>
_control_commit() {
local staged="$1" backups="$2"
local CONTROL_WRITABLE_KEYS="pools DONATION autotune watchdog watchdog_interval_min max_temp_c"
local change allow badkeys stamp backup cand msg
Expand Down
49 changes: 49 additions & 0 deletions scripts/build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail

PROG=${0##*/}
PKG_SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")/../packaging/debian" && pwd)"

die() {
printf '%s: %s\n' "$PROG" "$1" >&2
exit 1
}

[[ $# -eq 2 ]] || {
printf 'usage: %s <release-tarball.tar.gz> <tag-or-version>\n' "$PROG" >&2
exit 2
}

ARCHIVE=$1
VERSION=${2#v}
[[ -f $ARCHIVE ]] || die "release archive not found: $ARCHIVE"
[[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || die "not a release version: $2"

umask 022
STAGING=$(mktemp -d)
trap 'rm -rf -- "$STAGING"' EXIT
tar -xzf "$ARCHIVE" -C "$STAGING"

SRC=""
for d in "$STAGING"/*/; do
[[ -f $d/rigforge.sh ]] && SRC=${d%/} && break
done
[[ -n $SRC ]] || die "no top-level directory with rigforge.sh in the archive"
[[ "$(tr -d '[:space:]' <"$SRC/VERSION")" == "$VERSION" ]] || die "VERSION in archive ($(tr -d '[:space:]' <"$SRC/VERSION")) disagrees with $VERSION"

export SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(stat -c %Y "$SRC/VERSION")}

ROOT="$STAGING/root"
mkdir -p "$ROOT/usr/lib" "$ROOT/usr/bin" "$ROOT/usr/lib/systemd/system" "$ROOT/var/lib/rigforge" "$ROOT/DEBIAN"
cp -a "$SRC" "$ROOT/usr/lib/rigforge"
rm -rf "$ROOT/usr/lib/rigforge/docs/dev"
chmod -R go-w,ug-s "$ROOT/usr/lib/rigforge"
printf 'apt\n' >"$ROOT/usr/lib/rigforge/.rigforge-package"
install -m 0755 "$PKG_SRC/rigforge" "$ROOT/usr/bin/rigforge"
install -m 0644 "$PKG_SRC/rigforge-upgrade.service" "$ROOT/usr/lib/systemd/system/"
install -m 0755 "$PKG_SRC/postinst" "$PKG_SRC/prerm" "$PKG_SRC/postrm" "$ROOT/DEBIAN/"
sed "s/@VERSION@/$VERSION/" "$PKG_SRC/control" >"$ROOT/DEBIAN/control"

find "$ROOT" -exec touch -h -d "@$SOURCE_DATE_EPOCH" {} +
dpkg-deb --build --root-owner-group -Zxz "$ROOT" "rigforge_${VERSION}_all.deb" >/dev/null
printf '%s\n' "rigforge_${VERSION}_all.deb"
Loading
Loading