From 1ed3d436134b0028d25960bf86cdec967927aae7 Mon Sep 17 00:00:00 2001 From: Pavel Isaev Date: Fri, 6 Nov 2026 05:58:40 +0300 Subject: [PATCH] Preserve Core package integrity with separate GNOME configuration --- LAYERED-GNOME.md | 10 +++++----- adapters/build-iso.sh | 5 ++++- adapters/gnome-layer.sh | 9 +++++---- adapters/gnome-package.sh | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/LAYERED-GNOME.md b/LAYERED-GNOME.md index cb034b3..25e0e67 100644 --- a/LAYERED-GNOME.md +++ b/LAYERED-GNOME.md @@ -9,9 +9,8 @@ the existing Core-only path. This is a constrained adapter, not a frozen layer A 2. Check out its payload as the isolated Purpose build environment. Reuse its package database and frozen repository universe; never refresh target databases. 3. Install missing GNOME packages, rejecting Core package changes/removal and - undeclared changes to Core files. The only allowed file overrides are the - `archipelago`-owned OS identity defaults and initramfs configuration, with - expected input content and reasons recorded. + changes to Core files. GNOME identity and initramfs configuration use separate + Purpose-owned `defaults/os-release-gnome` and `mkinitcpio-gnome.conf` paths. 4. Capture additions and package records into a separate Purpose OSTree commit. Shared Core packages are requirements, not duplicated Purpose payload. 5. Compose fresh staging from Core plus the checked-out Purpose commit, without @@ -22,8 +21,8 @@ the existing Core-only path. This is a constrained adapter, not a frozen layer A record both input layer commits in the image commit. Reuse Core locales. `composer/layer_delta.py` implements this private filesystem adapter. Requirements -currently conservatively pin the Core package set and allowed override input -content, not a mandatory Core commit field. Provenance records the actual Core +currently conservatively pin the Core package set, not a mandatory Core commit +field. Provenance records the actual Core commit used. General dependency reassignment/removal, arbitrary overlays and a stable package-index schema remain separate work. Source assets are recorded as Purpose additions rather than rebuilding/replacing the Core `archipelago` package. @@ -62,6 +61,7 @@ Observed integration failures and permanent corrections: | Account backup differs from Core | Restore primary and `*-` account databases | Real capture completed | | Package inventory initializes repository trust/download user or cannot resolve relocated DB | Query through `arch-chroot` with `--config /dev/null --dbpath /usr/lib/archipelago/package-db -Q`; read only the local DB | Integration continuation pending | | Copy loses setuid/setgid or capabilities | Apply ownership before mode/xattrs; verify copied identity | Privileged-mode regression passed; real composition rerun pending | +| Installed GNOME fails package integrity for two Core-owned configuration files | Keep Core bytes unchanged; provide separate GNOME configs, select them for composition and Host Extension initramfs; run self-check before image capture | Cycle 20261105T233849Z rejected; corrected full cycle pending | Capture checks the copied object against the recorded source identity before commit. Compose validates input identities and checks each copied output. Keep diff --git a/adapters/build-iso.sh b/adapters/build-iso.sh index f08be3a..2579450 100644 --- a/adapters/build-iso.sh +++ b/adapters/build-iso.sh @@ -152,6 +152,9 @@ printf '%s\n' "$snapshot" > /job/core/usr/lib/archipelago/snapshot # Machine defaults are instantiated from the package, separate from package files. rm -f /job/core/etc/os-release cp /job/core/usr/lib/archipelago/defaults/os-release /job/core/etc/os-release +if [[ $profile == gnome-probe ]]; then + cp /job/core/usr/lib/archipelago/defaults/os-release-gnome /job/core/etc/os-release +fi printf 'archipelago\n' > /job/core/etc/hostname cp /job/core/usr/lib/archipelago/defaults/{locale.conf,vconsole.conf} /job/core/etc/ ln -sfn /usr/share/zoneinfo/UTC /job/core/etc/localtime @@ -173,7 +176,7 @@ find /job/core/var/lib/pacman/local -name install -exec cp --parents '{}' /job/e mkdir -p /job/core/usr/lib/archipelago/hook-policy (cd /job/core; sha256sum usr/share/libalpm/hooks/*.hook) > /job/core/usr/lib/archipelago/hook-policy/hooks.sha256 find /job/core/var/lib/pacman/local -name install -exec sha256sum '{}' + > /job/core/usr/lib/archipelago/hook-policy/scriptlets.sha256 -arch-chroot /job/core /bin/bash -euxc 'archipelago self-check; k=$(basename /usr/lib/modules/*); depmod "$k"; mkinitcpio -c /usr/lib/archipelago/mkinitcpio-core.conf -k "$k" -g "/usr/lib/modules/$k/initramfs.img"; ldconfig; systemd-hwdb update --usr' +arch-chroot /job/core /bin/bash -euxc 'archipelago self-check; k=$(basename /usr/lib/modules/*); depmod "$k"; config=/usr/lib/archipelago/mkinitcpio-core.conf; if [[ -f /usr/lib/archipelago/mkinitcpio-gnome.conf ]]; then config=/usr/lib/archipelago/mkinitcpio-gnome.conf; fi; mkinitcpio -c "$config" -k "$k" -g "/usr/lib/modules/$k/initramfs.img"; ldconfig; systemd-hwdb update --usr' pacman --sysroot /job/core -Q > /job/evidence/core-packages.txt cp /job/evidence/core-packages.txt /job/core/usr/lib/archipelago/packages.txt cp /var/cache/pacman/pkg/nano-*.pkg.tar.zst /job/core/usr/share/archipelago/packages/ diff --git a/adapters/gnome-layer.sh b/adapters/gnome-layer.sh index 2af3438..d53658f 100644 --- a/adapters/gnome-layer.sh +++ b/adapters/gnome-layer.sh @@ -75,14 +75,15 @@ rm -f "$stage/etc/.pwd.lock" mv "$stage/var/lib/pacman" "$stage/usr/lib/archipelago/package-db" mv "$stage/etc" "$stage/usr/etc" for db in /job/evidence/*.db; do cmp "$db" "$stage/usr/lib/archipelago/package-db/sync/$(basename "$db")"; done -# Distribution integration is a separately indexed Purpose contribution. Only two -# declared Core-owned configuration files may be overridden (see delta adapter). +# Distribution integration is a separately indexed Purpose contribution. Preserve +# Core package bytes and use distinct Purpose configuration paths. pkg=/job/purpose-assets mkdir -p "$pkg/runtime/usr/lib/archipelago/defaults" "$pkg/runtime/usr/lib/systemd/system" \ "$pkg/runtime/usr/lib/tmpfiles.d" "$pkg/runtime/usr/lib/systemd/system-preset" cp /job/core-base/usr/lib/archipelago/defaults/os-release "$pkg/runtime/usr/lib/archipelago/defaults/" cp /job/core-base/usr/lib/archipelago/mkinitcpio-core.conf "$pkg/runtime/usr/lib/archipelago/" @@GNOME_ASSETS@@ +rm "$pkg/runtime/usr/lib/archipelago/defaults/os-release" "$pkg/runtime/usr/lib/archipelago/mkinitcpio-core.conf" cp -a "$pkg/runtime/." "$stage/" python /job/layer-delta.py capture /job/core-base "$stage" /job/purpose-layer purpose_layer=$(ostree --repo=/job/repo commit -b layers/purpose/desktop/gnome --tree=dir=/job/purpose-layer \ @@ -96,9 +97,9 @@ rm -rf /job/purpose-stage /job/purpose-layer /job/purpose-input # All work below operates on the composition, never the immutable input layers. mv /job/composed /job/core mv /job/core/usr/etc /job/core/etc -cp /job/core/usr/lib/archipelago/defaults/os-release /job/core/etc/os-release +cp /job/core/usr/lib/archipelago/defaults/os-release-gnome /job/core/etc/os-release @@GNOME_FINALIZE@@ -arch-chroot /job/core /bin/bash -euxc 'k=$(basename /usr/lib/modules/*); depmod "$k"; mkinitcpio -c /usr/lib/archipelago/mkinitcpio-core.conf -k "$k" -g "/usr/lib/modules/$k/initramfs.img"; ldconfig; systemd-hwdb update --usr' +arch-chroot /job/core /bin/bash -euxc 'archipelago self-check; k=$(basename /usr/lib/modules/*); depmod "$k"; mkinitcpio -c /usr/lib/archipelago/mkinitcpio-gnome.conf -k "$k" -g "/usr/lib/modules/$k/initramfs.img"; ldconfig; systemd-hwdb update --usr' # Inventory is a read-only local DB query: do not initialize repository trust or # the download sandbox in a finalized root containing factory accounts. arch-chroot /job/core pacman --config /dev/null --dbpath /usr/lib/archipelago/package-db -Q > /job/evidence/core-packages.txt diff --git a/adapters/gnome-package.sh b/adapters/gnome-package.sh index 8d300e3..b2a62f9 100644 --- a/adapters/gnome-package.sh +++ b/adapters/gnome-package.sh @@ -1,8 +1,8 @@ # Packaged GNOME integration assets for the experimental desktop profile. -sed -i -e 's/HOOKS=(base systemd /HOOKS=(base systemd plymouth /' \ - -e 's/modconf block/modconf kms keyboard sd-vconsole block/' "$pkg/runtime/usr/lib/archipelago/mkinitcpio-core.conf" +sed -e 's/HOOKS=(base systemd /HOOKS=(base systemd plymouth /' \ + -e 's/modconf block/modconf kms keyboard sd-vconsole block/' "$pkg/runtime/usr/lib/archipelago/mkinitcpio-core.conf" > "$pkg/runtime/usr/lib/archipelago/mkinitcpio-gnome.conf" printf 'plymouth\n' > "$pkg/runtime/usr/lib/archipelago/desktop-boot" -sed -i 's/Archipelago Core/Archipelago GNOME/g' "$pkg/runtime/usr/lib/archipelago/defaults/os-release" +sed 's/Archipelago Core/Archipelago GNOME/g' "$pkg/runtime/usr/lib/archipelago/defaults/os-release" > "$pkg/runtime/usr/lib/archipelago/defaults/os-release-gnome" desktop="$pkg/runtime/usr/share/archipelago/desktop" units="$pkg/runtime/usr/lib/systemd/system" if [[ -f /job/gnome-software-plugin.so ]]; then