Skip to content

Add the package platform tag and a pacman platform guard - #539

Merged
maralcbr merged 15 commits into
quattro-upstreamfrom
mac/17-platform-guard
Sep 26, 2026
Merged

maralcbr merged 15 commits into
quattro-upstreamfrom
mac/17-platform-guard

Conversation

@maralcbr

@maralcbr maralcbr commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Ticket 17 of the Apple Silicon convergence plan. Base quattro-upstream. The recipe half, omacom/omarchy-pkgs#636, is merged: the settings recipes install the guard files when their source has them. The published omarchy-settings 4.0.4-2 is built from the pinned v4.0.4 source, so it carries no guard yet; builds from a quattro-upstream commit after this PR will.

What changed

  • Tagging contract (docs/platform-guard.md): a platform package declares groups=('omarchy-platform-<platform>'), <platform> being what omarchy-hw-platform prints. Only platform-only names are tagged. On omarchy-pkgs master only omarchy-mac-boot carries the tag so far; linux-aurora, m1n1-aurora, uboot-asahi and omarchy-mac merged without it and each needs the one-line groups= addition.
  • Guard: 00-omarchy-platform-guard.hook (PreTransaction, Install/Upgrade, AbortOnFail) runs omarchy-platform-guard, which reads tags from /var/lib/pacman/sync/*.db and refuses tagged packages for another platform. Untagged transactions pass without asking the platform; unreadable databases are skipped. As root it restarts in an empty environment. omarchy-settings ships the hook, the guard and its own copy of the detector.
  • Which platform: a booted system (systemd as PID 1 in the transaction root) asks the hardware; an image build (chroot, no /proc, or PID 1 not systemd) takes the root-owned image manifest from Defer image hardware setup to the Mac's first boot #528 (/var/lib/omarchy/image/target).
  • Fresh-install order: install/hardware/platform-guard.sh is hardware setup's first step. On Apple Silicon and Qualcomm it fails when the guard isn't resident; elsewhere it logs and continues. With the guard present it audits installed packages. The omarchy-mac README keeps the two-transaction rule (settings first, then omarchy-pkg-defaults apple-silicon).
  • Re-check on activation: a package test holds every omarchy-mac entry point and service to a platform check.

Refresh (2026-09-26)

  • Merged quattro-upstream. The only conflict was the omarchy-mac README setup paragraph (kept the two-transaction rule, took the omarchy-pkg-defaults wording).
  • Defer image hardware setup to the Mac's first boot #528's detector now treats a root as a build unless systemd is PID 1 there, and compares PID 1's root with the image root; the guard compared with /, so the guard suite failed after the merge. The guard now compares with the transaction root too (no change as root, where that root is /), and the fixtures model a booted machine as the detector reads one. New cases cover a non-systemd PID 1 and a missing /run/systemd/system.
  • Docs updated for today: the Mac image builder in omarchy-mac-installer main already installs settings with the base system, writes the manifest, then the runtime and the Apple set; tools/acceptance/mac-image needs no mask, since its guest device tree carries an Apple root compatible.

Rollout and skew

  • Candidate images: the builder requires omarchy and omarchy-settings from the same source commit at the same version, and installs settings first, so the guard is resident before any Apple package and on first boot. A failing guard step can't stop first boot: omarchy-provision-hardware exits 75, which omarchy-mac-first-boot treats as "retry later". It does hold every later hardware step (including the Limine step) until it passes. The candidate lane is ready: maralcbr/omarchy-pkgs lab/22-candidate-set 92e2f4f7 builds settings from Ship the Mac's app hooks and update takeover check for the step 6 seam #636's recipe (83f85a40). Its lab/build now refuses a set whose omarchy ships the guard step while omarchy-settings lacks the hook, script or detector copy. The lane build passed (run 36216406464).
  • Quattro runtime with the stock settings 4.0.4-2 (no guard) on a Mac or Snapdragon: hardware setup would stop at its first step with "install omarchy-settings in a transaction before hardware setup" (on an image, the queue waits as above). Pacman itself keeps working, just unguarded. Today nothing reaches that state: omarchy depends on omarchy-settings=${pkgver}, so the pair moves together. Test images pin both with IgnorePkg, and removing the pin moves both to the stock 4.0.4 pair, which has neither the step nor the hook. The legacy conversion installs both in one transaction and runs no hardware setup. Snapdragons run dragon, which doesn't consume quattro-upstream. Only an unversioned dev pair built from different trees could hit it, and on a Mac that stops hardware setup by design.

Testing

  • CI's Shell suites job, reproduced in its pinned archlinux:base-devel container on an x86_64 host: test/all fails only the two files in .github/known-test-failures, so the check passes. config-test.sh now passes against omarchy-pkgs master with Ship the Mac's app hooks and update takeover check for the step 6 seam #636. The omarchy-mac package and boot package suites pass.
  • platform-guard-test.sh in an aarch64 Arch container: passes as a normal user and as root (root probes). Before the fix, the same file failed on "a booted system ignores an image manifest" in both the aarch64 and x86 runs.
  • Real pacman 7.1 in an aarch64 Arch container with systemd as PID 1, using dummy packages from makepkg and repo-add, rerun on the final tree:
    • refused on generic aarch64: tagged installs, tagged dependency pull-ins and pacman -U of a tagged file; untagged packages install.
    • pacman -r chroot: refuses without a manifest, allows with platform=apple-silicon, and refuses Qualcomm packages there.
    • refused: a group-writable manifest, and a manifest in the live root.
    • honoured: the manifest, under a PID namespace whose PID 1 isn't systemd.
  • No test Mac needed; hardware acceptance of tagged images belongs to tickets 25/26/51.

Second review: earlier rounds found an environment bypass, the detector missing before the runtime installs, a dev-pair file move, the manifest diverging from ticket 41, and x86 installs aborting without the guard; all were fixed. This round confirmed the guard change is behaviour-neutral as root and that the tests still prove their names. It found the candidate lane's stale settings recipe pin (documented above; the lane belongs to ticket 22) and one dropped doc caveat (restored). A later round on the 2026-09-26 head (after #568 and #571-#577) confirmed the rollout analysis: no new path runs hardware setup on existing installs, and the #571 mx-mac migration installs the pair together. Fable re-check owed on that last round.

…latform

A package names its hardware platform with groups=('omarchy-platform-<platform>'),
readable from the repository databases. omarchy-settings ships a pre-transaction
hook that reads those tags for the transaction's packages and aborts when one
does not suit this machine. Image builds take the platform from a root-owned
manifest in the chroot; a booted system always asks its hardware.
A hook arriving in the same transaction as a package does not check it, so
hardware setup first requires the guard from omarchy-settings and checks the
packages an installer already placed. Nothing in system setup before it
installs packages.
Every command asks the Apple predicate before acting and every unit carries an
ExecCondition; a package test now keeps it that way. The setup contract installs
the add-on after the settings package on a fresh install, so the platform guard
checks it.
Hooks inherit pacman's environment. An exported awk function, a bad
TAR_READER_OPTIONS or a tiny TMOUT made the guard read no tags and let a
tagged package through, so root now runs it in privileged mode and restarts
it in an empty environment. A PID 1 whose root cannot be compared no longer
counts as an image build, and --platform lets the root probe check that the
platform ignores fixtures too.
The guard asks omarchy-hw-platform, which only omarchy shipped, so a
transaction installing omarchy with a tagged package after the settings
package would refuse it for want of a detector. omarchy-settings now ships
the detector too, and a refusal in a chroot without a manifest points the
builder at it. The contract doc now states builder and VM requirements as
requirements, and the tests require a real refusal rather than any failure.
Moving omarchy-hw-platform into omarchy-settings loses the file when the dev
pair installs in separate transactions, since omarchy-dev does not pin
omarchy-settings-dev's version. The settings package now ships a copy beside
the guard script and omarchy keeps its detector, so no file changes owner.
The builder hint no longer claims the hardware decided, and the install-order
check also catches pacman options that take a value.
@maralcbr
maralcbr changed the base branch from mac/13-hw-platform to quattro-upstream September 25, 2026 10:46
…ly where platform packages exist

The guard now reads /var/lib/omarchy/image/target by the rules of
install/helpers/image-target.sh (format=1, platform=, trusted directory and
file) instead of a manifest of its own. Hardware setup without a resident
guard fails only on Apple Silicon and Qualcomm; elsewhere it logs and goes on,
so an older unversioned settings-dev cannot stop an x86 install. The Mac setup
contract states the two-transaction rule, and the package test covers the
commands and helpers that ask omarchy-hw-platform directly.
maralcbr added a commit to omacom/omarchy-pkgs that referenced this pull request Sep 25, 2026
groups=('omarchy-platform-apple-silicon') is the platform tag the pacman
platform guard reads (omacom/omarchy-mac#539); the package is not published
yet, so it carries the tag from its first build. The pin moves to 3a58abb5,
omacom/omarchy-mac#541 with #527's current head merged in.
…atform-guard

# Conflicts:
#	packages/omarchy-mac/README.md
Since the detector takes the manifest whenever systemd is not PID 1 or the
root has no /run/systemd/system, the guard's own booted check follows the same
root, and the fixtures model a booted machine the way the detector reads one.
@maralcbr
maralcbr merged commit abad403 into quattro-upstream Sep 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant