Implement private KDE integration and optional release-cycle path

This commit is contained in:
Pavel Isaev 2026-11-06 20:59:41 +03:00
parent 460e037768
commit 8162991930
7 changed files with 207 additions and 7 deletions

36
LAYERED-KDE.md Normal file
View file

@ -0,0 +1,36 @@
# Private layered KDE adapter
`archipelago build iso --purpose kde WORK BOOTSTRAP` renders the same private
Core-reuse/composition path as GNOME, inserting KDE assets before finalization.
It requires `ARCHIPELAGO_CORE_BUILD`, a KDE installation-media Flatpak export,
and `ARCHIPELAGO_DISCOVER_PLUGIN`. Core is not rebuilt in this path.
The rendered path tokens are changed before injecting policies or helper source;
application IDs and shared helper contents are never globally rewritten. The
KDE assets require the Core CLI to match the current executable and require a
KDE update ref in the Core's update profile. Reusing a pre-KDE Core is rejected.
Discover runtime must be exactly `6.8.2-1`, matching the pinned plugin adapter.
Native first boot uses upstream Plasma Setup and SDDM. The installed-only drop-in
preserves upstream ordering and conditions. SDDM's greeter uses the packaged KWin
Wayland compositor. A timer observes `/etc/plasma-setup-done` and an authenticated
local SDDM session, verifies AccountsService identity, home,
wheel/sudo and subordinate ranges, then records Archipelago provisioning. No
account or completion marker is created by the builder.
The native Discover backend exposes one nonremovable OS resource and delegates
refresh/apply to the existing Polkit helper. Flatpak and fwupd remain separate.
The launcher selects those three backends; PackageKit is masked. Applying an OS
update stages it and reports reboot-required; the backend never reboots itself.
Support/customization descriptions come from the privileged shared CLI and retain
separate booted/pending labels.
## Verification status
Implementation source added 2026-11-06 while the existing Core/GNOME cycle runs.
No KDE compile, build or runtime check has yet run. The first pipeline must verify
the plugin ABI, actual Plasma Setup/SDDM handoff, subordinate-ID provisioning,
native application integration and the Flatpak/runtime closure. Its UI action
profile must be calibrated against the actual first image; a missing profile
retains the initial screen and fails acceptance rather than accepting a boot alone.
Full reproducibility and real GUI update acceptance remain separate open evidence.

View file

@ -58,6 +58,10 @@ 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_DISCOVER_PLUGIN:-} ]]; then
cp "$ARCHIPELAGO_DISCOVER_PLUGIN" "$work/discover-plugin.so"
sha256sum "$work/discover-plugin.so" > "$work/discover-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"

27
adapters/kde-finalize.sh Normal file
View file

@ -0,0 +1,27 @@
# Clean Core + KDE composition; existing-machine rebase is a separate workflow.
systemctl --root=/job/core disable systemd-networkd archipelago-firstboot@tty1 archipelago-firstboot@ttyS0 getty@tty1
systemctl --root=/job/core enable NetworkManager sddm plasma-setup bluetooth cups.socket power-profiles-daemon \
archipelago-kde-onboarding.timer archipelago-software-refresh.timer
systemctl --root=/job/core set-default graphical.target
mkdir -p /job/core/etc/sddm.conf.d
cat > /job/core/etc/sddm.conf.d/20-archipelago-wayland.conf <<'SDDM'
[General]
DisplayServer=wayland
[Wayland]
CompositorCommand=kwin_wayland --drm --no-lockscreen --no-global-shortcuts --locale1
SDDM
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
test ! -e /job/core/etc/plasma-setup-done
cp /job/core/usr/share/archipelago/desktop/toolbox.conf /job/core/etc/containers/toolbox.conf
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
mkdir -p /job/core/etc/systemd/system
ln -s /dev/null /job/core/etc/systemd/system/packagekit.service

112
adapters/kde-package.sh Normal file
View file

@ -0,0 +1,112 @@
# Private KDE Purpose integration, indexed independently of Core package bytes.
cmp /job/core-base/usr/bin/archipelago /job/archipelago
test "$(arch-chroot /job/purpose-stage pacman --config /dev/null --dbpath /usr/lib/archipelago/package-db -Q discover)" = 'discover 6.8.2-1'
arch-chroot /job/purpose-stage python -c 'import json; p=json.load(open("/usr/lib/archipelago/update.json")); assert p["refs"]["kde"]'
mkdir -p "$pkg/runtime/usr/etc/pacman.d/hooks"
ln -s /dev/null "$pkg/runtime/usr/etc/pacman.d/hooks/90-packagekit-refresh.hook"
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-kde.conf"
printf 'plymouth\n' > "$pkg/runtime/usr/lib/archipelago/desktop-boot"
sed 's/Archipelago Core/Archipelago KDE/g' "$pkg/runtime/usr/lib/archipelago/defaults/os-release" > "$pkg/runtime/usr/lib/archipelago/defaults/os-release-kde"
printf 'purpose/desktop/kde\n' > "$pkg/runtime/usr/lib/archipelago/purpose"
printf 'Plasma Setup is the native first-user provisioner.\n' > "$pkg/runtime/usr/lib/archipelago/kde-firstboot"
desktop="$pkg/runtime/usr/share/archipelago/desktop"
units="$pkg/runtime/usr/lib/systemd/system"
mkdir -p "$desktop" "$units/plasma-setup.service.d" "$pkg/runtime/usr/share/polkit-1/actions"
cat > "$desktop/flatpak-apps.json" <<'POLICY'
@@FLATPAK_POLICY@@
POLICY
if [[ -f /job/flatpak-policy.json ]]; then cp /job/flatpak-policy.json "$desktop/flatpak-apps.json"; fi
cp /job/flathub.flatpakrepo "$desktop/flathub.flatpakrepo"
cat > "$desktop/toolbox.conf" <<'TOOLBOX'
@@TOOLBOX_CONFIG@@
TOOLBOX
if [[ -f /job/toolbox.conf ]]; then cp /job/toolbox.conf "$desktop/toolbox.conf"; fi
cat > "$units/plasma-setup.service.d/10-archipelago-installed.conf" <<'SETUP'
[Unit]
ConditionPathExists=/run/ostree-booted
ConditionPathExists=!/run/archipelago-live
SETUP
cat > "$units/archipelago-kde-onboarding.service" <<'SERVICE'
[Unit]
Description=Observe completed Plasma Setup and authenticated desktop login
ConditionPathExists=/run/ostree-booted
ConditionPathExists=/usr/lib/archipelago/kde-firstboot
ConditionPathExists=/etc/plasma-setup-done
ConditionPathExists=!/etc/archipelago/provisioned
After=display-manager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/archipelago desktop reconcile
TimeoutStartSec=60
SERVICE
cat > "$units/archipelago-kde-onboarding.timer" <<'TIMER'
[Unit]
Description=Check Plasma Setup first-user completion
ConditionPathExists=/usr/lib/archipelago/kde-firstboot
[Timer]
OnBootSec=15
OnUnitActiveSec=15
[Install]
WantedBy=timers.target
TIMER
test -f /job/discover-plugin.so
mkdir -p "$pkg/runtime/usr/lib/qt6/plugins/discover"
install -m755 /job/discover-plugin.so "$pkg/runtime/usr/lib/qt6/plugins/discover/archipelago-backend.so"
cat > "$pkg/runtime/usr/lib/archipelago/discover" <<'DISCOVER'
#!/bin/sh
exec /usr/bin/plasma-discover --backends archipelago-backend,flatpak-backend,fwupd-backend "$@"
DISCOVER
chmod 0755 "$pkg/runtime/usr/lib/archipelago/discover"
mkdir -p "$pkg/runtime/usr/share/archipelago/desktop-overrides/applications" "$pkg/runtime/usr/lib/environment.d"
cat > "$pkg/runtime/usr/lib/environment.d/60-archipelago-desktop.conf" <<'ENV'
XDG_DATA_DIRS=/usr/share/archipelago/desktop-overrides:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
ENV
cat > "$pkg/runtime/usr/share/archipelago/desktop-overrides/applications/org.kde.discover.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Discover
Comment=Applications, firmware and Archipelago updates
Exec=/usr/lib/archipelago/discover %U
Icon=plasmadiscover
Terminal=false
Categories=Qt;KDE;System;PackageManager;
MimeType=application/vnd.flatpak;application/vnd.flatpak.repo;application/vnd.flatpak.ref;
DESKTOP
for entry in stoken-gui stoken-gui-small; do
cat > "$pkg/runtime/usr/share/archipelago/desktop-overrides/applications/$entry.desktop" <<'TOKEN'
[Desktop Entry]
Type=Application
Name=Software Token
Exec=stoken-gui
NoDisplay=true
TOKEN
done
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"
cat > "$pkg/runtime/usr/lib/systemd/system-preset/10-archipelago-kde.preset" <<'PRESET'
disable archipelago-firstboot@tty1.service
disable archipelago-firstboot@ttyS0.service
disable systemd-networkd.service
enable NetworkManager.service
enable systemd-resolved.service
enable plasma-setup.service
enable sddm.service
enable bluetooth.service
enable cups.socket
enable power-profiles-daemon.service
enable archipelago-kde-onboarding.timer
enable archipelago-software-refresh.timer
PRESET

View file

@ -27,7 +27,7 @@ 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])
assert parts[1].startswith(('org.gnome.', 'org.kde.')) and all(c.isalnum() or c in '._-' for c in parts[1])
print(ref)
PY
mapfile -t apps < /seed/apps.txt

View file

@ -1,6 +1,6 @@
{
"version": 1,
"url": "https://mirror.nw-sys.ru/archipelago/ostree/images",
"refs": {"core": "stable/core", "gnome": "stable/gnome"},
"refs": {"core": "stable/core", "gnome": "stable/gnome", "kde": "stable/kde"},
"public_key_file": "/usr/share/archipelago/keys/ostree.asc"
}

View file

@ -1,7 +1,17 @@
//! Experimental x86_64 Core ISO profile. Native tools execute inside nspawn.
pub fn build_iso_script() -> String {
let gnome = include_str!("../adapters/gnome-package.sh")
.replace("@@FLATPAK_POLICY@@", include_str!("../../purposes/proposals/gnome-flatpak-apps.json"))
render_iso(false)
}
fn render_iso(kde: bool) -> String {
let assets = if kde { include_str!("../adapters/kde-package.sh") } else { include_str!("../adapters/gnome-package.sh") };
let policy = if kde { include_str!("../../purposes/proposals/kde-flatpak-apps.json") } else { include_str!("../../purposes/proposals/gnome-flatpak-apps.json") };
let finalizer = if kde { include_str!("../adapters/kde-finalize.sh") } else { include_str!("../adapters/gnome-finalize.sh") };
// Render private profile path tokens before inserting assets: application IDs,
// common helpers and policy contents must never undergo variant substitution.
let profile = |text: &str| if kde { text.replace("gnome", "kde").replace("GNOME", "KDE") } else { text.to_owned() };
let gnome = assets
.replace("@@FLATPAK_POLICY@@", policy)
.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"))
@ -10,13 +20,24 @@ pub fn build_iso_script() -> String {
let package = include_str!("../adapters/package.sh")
.replace("@@PKGBUILD@@", include_str!("../../cli/packaging/PKGBUILD"))
.replace("@@GNOME_PACKAGE@@", &gnome);
include_str!("../adapters/build-iso.sh").replace("@@PACKAGE_SCRIPT@@", &package)
.replace("@@GNOME_LAYER_BUILD@@", &include_str!("../adapters/gnome-layer.sh").replace("@@GNOME_ASSETS@@", &gnome))
let layer = profile(include_str!("../adapters/gnome-layer.sh"))
.replace(if kde { "@@KDE_ASSETS@@" } else { "@@GNOME_ASSETS@@" }, &gnome);
profile(include_str!("../adapters/build-iso.sh")).replace("@@PACKAGE_SCRIPT@@", &package)
.replace(if kde { "@@KDE_LAYER_BUILD@@" } else { "@@GNOME_LAYER_BUILD@@" }, &layer)
.replace("@@LAYER_DELTA@@", include_str!("../../composer/layer_delta.py"))
.replace("@@UPDATE_PROFILE@@", include_str!("../defaults/update.json"))
.replace("@@UPDATE_PUBLIC_KEY@@", include_str!("../../system/archipelago-stable.asc"))
.replace("@@FLATPAK_IMPORT@@", include_str!("../../installer/adapters/flatpak-import.sh"))
.replace("@@GNOME_FINALIZE@@", include_str!("../adapters/gnome-finalize.sh"))
.replace(if kde { "@@KDE_FINALIZE@@" } else { "@@GNOME_FINALIZE@@" }, finalizer)
}
/// KDE uses the same private composition path and the cycle's immutable Core.
pub fn build_kde_probe_script() -> Result<String, String> {
let data = archipelago_contracts::layer::validate(include_str!("../../purposes/proposals/kde.yaml"))?;
let packages = data["spec"]["packages"]["runtime"].as_array().ok_or("Missing KDE packages")?
.iter().map(|p| p["name"].as_str().ok_or("Invalid KDE package"))
.collect::<Result<Vec<_>, _>>()?.join("\n");
Ok(render_iso(true).replace("# KDE_PACKAGE_LIST", &packages))
}
/// A private integration probe, not the independent Layer v1 build pipeline.