From 7534fe4a253da23878faf9f1df1c4b8582984e6b Mon Sep 17 00:00:00 2001 From: Pavel Isaev Date: Fri, 6 Nov 2026 00:09:27 +0300 Subject: [PATCH] Record native desktop delivery, update integration and validation work in progress --- FLATPAK-OFFLINE.md | 45 ++++++++++++++++++++++++++++++++ adapters/build-iso.sh | 11 +++++++- adapters/gnome-finalize.sh | 12 +++++---- adapters/gnome-package.sh | 27 ++++++++++++++++--- adapters/package.sh | 6 +++++ adapters/prepare-flatpak-seed.sh | 38 +++++++++++++++++++++++++++ defaults/update.json | 2 +- src/lib.rs | 4 +++ 8 files changed, 135 insertions(+), 10 deletions(-) create mode 100644 FLATPAK-OFFLINE.md create mode 100644 adapters/prepare-flatpak-seed.sh diff --git a/FLATPAK-OFFLINE.md b/FLATPAK-OFFLINE.md new file mode 100644 index 0000000..3831ed0 --- /dev/null +++ b/FLATPAK-OFFLINE.md @@ -0,0 +1,45 @@ +# Offline Desktop application delivery + +**Superseded by user direction:** default GNOME applications now ship as native +Arch packages in the OS image; future KDE follows the same rule. Parallel optional +Flatpak installations remain allowed. The preparation experiment is stopped and +this document is retained as historical design context, not a release prerequisite. + +User-approved delivery requirement, 2026-11-05: ship default applications and their +runtime dependencies on installation media. First installation must succeed without +Flathub access, including when the machine's RTC is incorrect. Subsequent application +updates/removal remain normal Flatpak operations. This is not release acceptance. + +## Implementation candidate + +Use upstream `flatpak create-usb` to export a verified, isolated system installation +as a sideload repository, preserving Flathub collection identities and signatures. +Resolve/download on the builder, record every app/runtime ref and commit, remote +configuration, trust input and locale/GL extensions. Freeze these inputs before ISO +assembly. Retain shared objects once, rather than separate bundles per application. + +The ISO carries the repository and a digest-bound inventory. Installation populates +the target's persistent `/var/lib/flatpak` using Flatpak, before declaring desktop +installation complete. No build-machine user accounts or home data are copied. +Keep the configured remote pointing at Flathub for future updates. Do not rely on +`--sideload-repo` alone to prohibit network: acceptance runs in a network namespace +without external connectivity. Determine and verify the exact import sequence with +the packaged Flatpak version before integrating it into the installer. + +Do not disable TLS/GPG checks or change the system clock to bypass verification. +Test signature behavior under skewed RTC explicitly; successful online builder +verification alone does not establish that target-side import works with that clock. +NTP remains enabled for later online operations. + +## Delivery acceptance + +The user narrowed this check: on the installed VM, verify that every declared +default application and its required runtimes are installed. Record refs, commits +and origins. Separate disconnected-network, skewed-clock and per-app launch +scenarios are not required for this delivery check. Existing OS/GUI acceptance +requirements remain separate. + +Implementation still preserves signatures, original update origins, user removals +and isolated preparation. Do not report interrupted or incomplete imports as done. + +Reference: https://docs.flatpak.org/en/latest/usb-drives.html diff --git a/adapters/build-iso.sh b/adapters/build-iso.sh index a2a836d..4da33a4 100644 --- a/adapters/build-iso.sh +++ b/adapters/build-iso.sh @@ -48,6 +48,10 @@ if [[ -n ${ARCHIPELAGO_UPDATE_PROFILE:-} ]]; then cp "$ARCHIPELAGO_UPDATE_PUBLIC_KEY" "$work/ostree.asc" fi if [[ -n ${ARCHIPELAGO_TOOLBOX_CONFIG:-} ]]; then cp "$ARCHIPELAGO_TOOLBOX_CONFIG" "$work/toolbox.conf"; fi +if [[ -n ${ARCHIPELAGO_SOFTWARE_PLUGIN:-} ]]; then + cp "$ARCHIPELAGO_SOFTWARE_PLUGIN" "$work/gnome-software-plugin.so" + sha256sum "$work/gnome-software-plugin.so" > "$work/software-plugin.sha256" +fi if [[ -n ${ARCHIPELAGO_FLATPAK_POLICY:-} ]]; then cp "$ARCHIPELAGO_FLATPAK_POLICY" "$work/flatpak-policy.json"; fi grep -q '^DisableSandbox' "$toolroot/etc/pacman.conf" || sed -i '/\[options\]/a DisableSandbox\nNoProgressBar' "$toolroot/etc/pacman.conf" install -m755 "$binary" "$work/archipelago" @@ -131,7 +135,12 @@ ln -sfn /usr/share/zoneinfo/UTC /job/core/etc/localtime mkdir -p /job/core/etc/systemd/network cp /job/core/usr/lib/archipelago/defaults/20-wired.network /job/core/etc/systemd/network/ ln -sfn /run/systemd/resolve/stub-resolv.conf /job/core/etc/resolv.conf -systemctl --root=/job/core enable systemd-networkd systemd-resolved sshd archipelago-ssh-keys archipelago-keyring archipelago-firstboot@tty1 archipelago-firstboot@ttyS0 getty@tty1 serial-getty@ttyS0 ostree-remount +systemctl --root=/job/core enable systemd-networkd systemd-resolved systemd-timesyncd sshd archipelago-ssh-keys archipelago-keyring archipelago-firstboot@tty1 archipelago-firstboot@ttyS0 getty@tty1 serial-getty@ttyS0 ostree-remount +# Generate every locale supplied by glibc, including non-UTF-8 variants. This +# shared Core output is inherited by every Purpose; never borrow host locales. +sed -i -E 's/^#[[:space:]]*([a-z][a-z][a-z]?_[A-Z][A-Z][^[:space:]]*[[:space:]]+[^[:space:]#]+)[[:space:]]*$/\1/' /job/core/etc/locale.gen +arch-chroot /job/core locale-gen > /job/evidence/locales.log 2>&1 +arch-chroot /job/core locale -a > /job/evidence/locales.txt if [[ $ARCHIPELAGO_BUILD_PROFILE == gnome-probe ]]; then @@GNOME_FINALIZE@@ fi diff --git a/adapters/gnome-finalize.sh b/adapters/gnome-finalize.sh index 033b0bc..6c8509d 100644 --- a/adapters/gnome-finalize.sh +++ b/adapters/gnome-finalize.sh @@ -1,18 +1,20 @@ # Initial clean GNOME integration profile only; not a generic rebase adapter. systemctl --root=/job/core disable systemd-networkd archipelago-firstboot@tty1 archipelago-firstboot@ttyS0 getty@tty1 systemctl --root=/job/core enable NetworkManager gdm bluetooth cups.socket power-profiles-daemon switcheroo-control \ - archipelago-gnome-onboarding.timer archipelago-flatpak-defaults.timer + archipelago-gnome-onboarding.timer systemctl --root=/job/core set-default graphical.target +if [[ -f /job/core/usr/lib/archipelago/software-helper ]]; then + systemctl --root=/job/core enable archipelago-software-refresh.timer +fi mkdir -p /job/core/etc/NetworkManager/conf.d /job/core/etc/sudoers.d /job/core/etc/containers /job/core/etc/archipelago printf '[main]\ndns=systemd-resolved\n' > /job/core/etc/NetworkManager/conf.d/20-archipelago.conf printf '%%wheel ALL=(ALL:ALL) ALL\n' > /job/core/etc/sudoers.d/10-archipelago-wheel chmod 0440 /job/core/etc/sudoers.d/10-archipelago-wheel arch-chroot /job/core visudo -c +mkdir -p /job/core/etc/plymouth +printf '[Daemon]\nTheme=spinner\n' > /job/core/etc/plymouth/plymouthd.conf +test -f /job/core/usr/share/plymouth/themes/spinner/spinner.plymouth cp /job/core/usr/share/archipelago/desktop/toolbox.conf /job/core/etc/containers/toolbox.conf -sed -i -E 's/^#[[:space:]]*((en_US|ru_RU)\.UTF-8[[:space:]]+UTF-8)[[:space:]]*$/\1/' /job/core/etc/locale.gen -grep -Eq '^en_US\.UTF-8[[:space:]]+UTF-8$' /job/core/etc/locale.gen -grep -Eq '^ru_RU\.UTF-8[[:space:]]+UTF-8$' /job/core/etc/locale.gen -arch-chroot /job/core locale-gen arch-chroot /job/core glib-compile-schemas /usr/share/glib-2.0/schemas arch-chroot /job/core update-desktop-database /usr/share/applications arch-chroot /job/core update-mime-database /usr/share/mime diff --git a/adapters/gnome-package.sh b/adapters/gnome-package.sh index 6ec3c7c..8d300e3 100644 --- a/adapters/gnome-package.sh +++ b/adapters/gnome-package.sh @@ -1,7 +1,28 @@ # 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" +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" desktop="$pkg/runtime/usr/share/archipelago/desktop" units="$pkg/runtime/usr/lib/systemd/system" +if [[ -f /job/gnome-software-plugin.so ]]; then + mkdir -p "$pkg/runtime/usr/lib/gnome-software/plugins-23" "$pkg/runtime/usr/share/polkit-1/actions" + install -m755 /job/gnome-software-plugin.so "$pkg/runtime/usr/lib/gnome-software/plugins-23/libgs_plugin_archipelago.so" + cat > "$pkg/runtime/usr/lib/archipelago/software-helper" <<'HELPER' +@@SOFTWARE_HELPER@@ +HELPER + chmod 0755 "$pkg/runtime/usr/lib/archipelago/software-helper" + cat > "$pkg/runtime/usr/share/polkit-1/actions/org.archipelago.software.policy" <<'POLKIT' +@@SOFTWARE_POLICY@@ +POLKIT + cat > "$units/archipelago-software-refresh.service" <<'SERVICE' +@@SOFTWARE_SERVICE@@ +SERVICE + cat > "$units/archipelago-software-refresh.timer" <<'TIMER' +@@SOFTWARE_TIMER@@ +TIMER + printf 'd /var/lib/archipelago/software 0755 root root -\n' > "$pkg/runtime/usr/lib/tmpfiles.d/archipelago-software.conf" +fi mkdir -p "$desktop" "$pkg/runtime/usr/share/gnome-initial-setup" cat > "$desktop/flatpak-apps.json" <<'POLICY' @@FLATPAK_POLICY@@ @@ -43,8 +64,8 @@ Description=Install initial Flatpak application defaults ConditionPathExists=/run/ostree-booted ConditionPathExists=/etc/archipelago/provisioned ConditionPathExists=!/var/lib/archipelago/flatpak-defaults-v1/done -Wants=network-online.target -After=network-online.target +Wants=network-online.target time-set.target +After=network-online.target time-set.target [Service] Type=oneshot ExecStart=/usr/bin/archipelago desktop seed-flatpaks @@ -76,5 +97,5 @@ enable cups.socket enable power-profiles-daemon.service enable switcheroo-control.service enable archipelago-gnome-onboarding.timer -enable archipelago-flatpak-defaults.timer +disable archipelago-flatpak-defaults.timer EOF diff --git a/adapters/package.sh b/adapters/package.sh index 6f7323e..b34b8cf 100644 --- a/adapters/package.sh +++ b/adapters/package.sh @@ -18,11 +18,16 @@ cat > "$pkg/runtime/usr/lib/systemd/system/archipelago-keyring.service" <<'EOF' Description=Initialize target pacman trust from packaged public keys ConditionPathExists=/run/ostree-booted Before=archipelago-firstboot@tty1.service archipelago-firstboot@ttyS0.service +Wants=time-set.target +After=time-set.target +StartLimitIntervalSec=0 [Service] Type=oneshot ExecStart=/usr/bin/pacman-key --init ExecStart=/usr/bin/pacman-key --populate archlinux archipelago RemainAfterExit=yes +Restart=on-failure +RestartSec=30s [Install] WantedBy=multi-user.target EOF @@ -134,6 +139,7 @@ enable archipelago-ssh-keys.service enable ostree-remount.service enable systemd-networkd.service enable systemd-resolved.service +enable systemd-timesyncd.service enable sshd.service EOF if [[ ${ARCHIPELAGO_BUILD_PROFILE:-core} == gnome-probe ]]; then diff --git a/adapters/prepare-flatpak-seed.sh b/adapters/prepare-flatpak-seed.sh new file mode 100644 index 0000000..74759b6 --- /dev/null +++ b/adapters/prepare-flatpak-seed.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Run only inside an isolated disposable Arch builder. /seed is private persistent +# build storage, /var/lib/flatpak is a dedicated installation, never the host's. +set -euo pipefail +test "$(id -u)" = 0 +test -f /run/archipelago-flatpak-seed-builder +mkdir -p /seed/evidence +exec > >(tee -a /seed/evidence/prepare.log) 2>&1 +pacman -S --needed --noconfirm flatpak python +date --utc --iso-8601=seconds > /seed/evidence/started +pacman -Q > /seed/evidence/builder-packages.txt +curl --fail --location --max-time 120 https://dl.flathub.org/repo/flathub.flatpakrepo -o /seed/flathub.flatpakrepo +printf '%s %s\n' 3371dd250e61d9e1633630073fefda153cd4426f72f4afa0c3373ae2e8fea03a /seed/flathub.flatpakrepo | sha256sum -c - +flatpak remote-add --system --if-not-exists flathub /seed/flathub.flatpakrepo +flatpak remote-modify --system --collection-id=org.flathub.Stable flathub +# Include all translations; the installed machine's eventual locale is unknown. +flatpak config --system --set languages '*' +python - <<'PY' > /seed/apps.txt +import json +policy=json.load(open('/policy.json')) +assert policy['version']==1 and policy['remote']=='flathub' +for ref in policy['applications']: + parts=ref.split('/') + assert len(parts)==4 and parts[0]=='app' and parts[2:] == ['x86_64','stable'] + assert parts[1].startswith('org.gnome.') and all(c.isalnum() or c in '._-' for c in parts[1]) + print(ref) +PY +mapfile -t apps < /seed/apps.txt +test "${#apps[@]}" -gt 0 +flatpak install --system --noninteractive --assumeyes flathub "${apps[@]}" +flatpak list --system --columns=ref,origin,active > /seed/evidence/refs.tsv +flatpak remotes --system --show-details > /seed/evidence/remotes.txt +test ! -e /seed/export +mkdir /seed/export +flatpak create-usb --system /seed/export "${apps[@]}" +ostree --repo=/seed/export/.ostree/repo fsck +date --utc --iso-8601=seconds > /seed/evidence/export-complete +echo 'SEED_EXPORT_COMPLETE: offline import and clock-skew acceptance still required' diff --git a/defaults/update.json b/defaults/update.json index 8b572bb..325bb0a 100644 --- a/defaults/update.json +++ b/defaults/update.json @@ -1,6 +1,6 @@ { "version": 1, "url": "https://mirror.nw-sys.ru/archipelago/ostree/images", - "refs": {"core": "hardware-test/core", "gnome": "hardware-test/gnome"}, + "refs": {"core": "stable/core", "gnome": "stable/gnome"}, "public_key_file": "/usr/share/archipelago/keys/ostree.asc" } diff --git a/src/lib.rs b/src/lib.rs index 404b56c..d041c2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,10 @@ pub fn build_iso_script() -> String { .replace("@@PKGBUILD@@", include_str!("../../cli/packaging/PKGBUILD")) .replace("@@GNOME_PACKAGE@@", &include_str!("../adapters/gnome-package.sh") .replace("@@FLATPAK_POLICY@@", include_str!("../../purposes/proposals/gnome-flatpak-apps.json")) + .replace("@@SOFTWARE_HELPER@@", include_str!("../../system/integrations/gnome-software/software-helper")) + .replace("@@SOFTWARE_POLICY@@", include_str!("../../system/integrations/gnome-software/org.archipelago.software.policy")) + .replace("@@SOFTWARE_SERVICE@@", include_str!("../../system/integrations/gnome-software/archipelago-software-refresh.service")) + .replace("@@SOFTWARE_TIMER@@", include_str!("../../system/integrations/gnome-software/archipelago-software-refresh.timer")) .replace("@@TOOLBOX_CONFIG@@", include_str!("../../purposes/common/desktop/toolbox.conf"))); include_str!("../adapters/build-iso.sh").replace("@@PACKAGE_SCRIPT@@", &package) .replace("@@UPDATE_PROFILE@@", include_str!("../defaults/update.json"))