Field Notes FN-05
FN-05 2026-12-05 Infrastructure 6 min read

Shipping Signed APT, RPM, Pacman, and Homebrew Releases From One Cloudflare R2 Bucket

How Beck Labs runs one zero-egress signed package repository at pkg.becklabs.dev for Ubuntu, Fedora, and Arch with an offline GPG root, static musl binaries, and a single setup script.

Most independent Rust CLIs stop at GitHub Releases and a Homebrew tap. Linux users get handed a curl | sh script that drops a binary into ~/.local/bin, leaving them with no cryptographic repo verification and no automatic updates when they run apt upgrade, dnf upgrade, or pacman -Syu.

Maintaining separate package hosting infrastructure for Debian/Ubuntu, Fedora/RHEL, and Arch/Omarchy usually feels like overkill for a small studio. When we prepared Switchgear (OSS-02) for public release, we decided to solve cross-platform packaging once for the entire lab so every current and future Beck Labs CLI (switchgear, governor, and beyond) inherits first-class distribution out of the box.

One Bucket, Four Native Install Paths

Everything lives inside a single public Cloudflare R2 bucket (becklabs-pkg) served over HTTPS at pkg.becklabs.dev with zero egress fees:

https://pkg.becklabs.dev/
├── index.html          # Unified setup instructions
├── setup-repo.sh       # Idempotent distro-detecting repo + install 1-liner
├── gpg.asc             # Shared Beck Labs GPG public key
├── <slug>/install.sh   # Per-tool zero-sudo standalone binary installer
├── apt/                # Debian / Ubuntu / WSL2 (amd64 + arm64)
├── rpm/                # Fedora / RHEL / Rocky (x86_64 + aarch64)
└── pacman/             # Arch / Omarchy / CachyOS (x86_64 + aarch64)

For Linux users who want native package-manager tracking and automatic OS updates, setup is one idempotent command:

curl -fsSL https://pkg.becklabs.dev/setup-repo.sh | sudo sh -s -- switchgear

The script validates package names, detects pacman, apt, or dnf, imports and verifies the Beck Labs GPG key, configures the repo cleanly without duplicating entries, and installs the requested package(s). macOS and Linux Homebrew users continue using brew install beckhq/tap/<tool>, and anyone who prefers a zero-sudo install can still grab a SHA-256 verified static binary via <slug>/install.sh.

Offline GPG Root, Scoped CI Subkey

Putting a primary GPG key in GitHub Actions is an avoidable risk. Instead, we generate a dedicated RSA-4096 primary [C] key for Beck Labs Package Repository <pkg@becklabs.dev> (FF881196B02FA696041C5887774A4CBDE856C3DD) that stays strictly offline, plus a time-bounded RSA-4096 [S] signing subkey stored as a beckhq organization Actions secret.

If the CI subkey ever needs rotation or revocation, the offline primary key stays intact and users never have to re-trust a brand-new root identity.

Multi-Tool Bucket Preservation and Cache Discipline

Because multiple Beck Labs projects share one R2 bucket, our release script (publish-r2-repos.sh) always syncs existing apt/pool/, rpm/packages/, and pacman/ artifacts down from R2 before regenerating repository metadata. Publishing a new release of governor automatically preserves every existing version of switchgear, and vice versa.

Upload ordering also matters on object storage: immutable package binaries upload first with Cache-Control: public, max-age=31536000, immutable, and mutable signed index files (InRelease, repomd.xml, becklabs.db) upload second with max-age=300 so no user ever fetches an index pointing to a missing package.

Six Sharp Edges We Hit (So You Do Not Have To)

Wiring APT, RPM, and Pacman inside one GitHub Actions workflow exposed a handful of subtle packaging traps that are now baked into our reusable templates:

  1. Always compile Linux releases as static musl. Building gnu binaries on ubuntu-latest (Ubuntu 24.04 / glibc 2.39) quietly breaks Ubuntu 22.04, Debian 12, and RHEL 9. Static musl binaries via taiki-e/setup-cross-toolchain-action run anywhere with zero glibc drift.
  2. Render nfpm.yaml with envsubst. nfpm does not expand ${VAR} inside contents[].src, so keeping binary paths literal and templating VERSION and ARCH via envsubst avoids silent empty packages.
  3. Glob <slug>*, not <slug>-*. Debian .deb filenames use underscores (switchgear_0.2.1-1_amd64.deb), while RPM, Pacman, and tarballs use hyphens.
  4. Wrap __gpg on RPM 4.19+. Newer rpm on Ubuntu 24.04 changed __gpg_sign_cmd macro arguments; overriding only __gpg with a small wrapper script lets rpm --addsign use its native invocation cleanly across versions.
  5. Sign .pkg.tar.zst.sig before running Arch repo-add, and materialize symlinks. Signing packages first embeds %PGPSIG% directly into becklabs.db.tar.gz so Arch and Omarchy users keep default signature verification enabled. Because S3 and R2 object storage do not serve POSIX symlinks, the becklabs.db -> becklabs.db.tar.gz symlinks produced by repo-add must be materialized as real files before upload (and repo-add should run as a non-root UID).
  6. Export CI GPG subkeys without a trailing !. Running gpg --armor --export-secret-subkeys <PRIMARY_FPR> exports the stub primary (sec#) plus the secret [S] subkey (ssb). Appending ! exports only the certify-only primary key, which fails to sign in CI.

The end result is a shared release foundation that costs pennies on Cloudflare R2, scales cleanly across every CLI in the Beck Labs catalog, and treats Linux users as first-class citizens from day one.