[neon/snap-packaging/plasma-core22-desktop] hooks: Fix the desktop-launch system

Kevin Ottens null at kde.org
Tue May 14 12:17:07 BST 2024


Git commit 3e02b9aa9d7086408379b64f168610defb2bb423 by Kevin Ottens.
Committed on 14/05/2024 at 11:17.
Pushed by ervin into branch 'master'.

Fix the desktop-launch system

startplasma-wayland is pushing its environment to user systemd and dbus
activation environments. In turn this meant that when attempting to
launch a snap via its desktop file we'd have an infinite loop calling
through systemd-run always assuming it was under confinement.

So we add a service triggered at the very beginning of the session
emptying the SNAP environment variable to avoid snapd tripping over it.

M  +18   -0    hooks/006-zzz-add-plasma-session.chroot

https://invent.kde.org/neon/snap-packaging/plasma-core22-desktop/-/commit/3e02b9aa9d7086408379b64f168610defb2bb423

diff --git a/hooks/006-zzz-add-plasma-session.chroot b/hooks/006-zzz-add-plasma-session.chroot
index 2a2ae25..0e2a862 100755
--- a/hooks/006-zzz-add-plasma-session.chroot
+++ b/hooks/006-zzz-add-plasma-session.chroot
@@ -64,3 +64,21 @@ rm /usr/lib/x86_64-linux-gnu/qt6/plugins/discover/fwupd-backend.so
 rm -rf /usr/share/doc/plasma-discover-backend-fwupd/*
 rm /usr/lib/x86_64-linux-gnu/qt6/plugins/discover/kns-backend.so
 rm /usr/share/metainfo/org.kde.discover.packagekit.appdata.xml
+
+# Clean up the systemd and dbus activation environment at beginning
+# of startup (just after startplasma pushed its own environment)
+# this is necessary to avoid the desktop-launch routine wrongfully
+# thinking it's run from a confined snap
+cat >/usr/lib/systemd/user/plasma-env-cleanup.service<<EOF
+[Unit]
+Description=KDE Plasma Activation Environments Cleanups
+PartOf=graphical-session.target
+Before=plasma-kwin_wayland.service
+
+[Service]
+ExecStart=dbus-update-activation-environment --systemd SNAP=""
+Slice=session.slice
+EOF
+
+mkdir /usr/lib/systemd/user/plasma-workspace-wayland.target.wants
+ln -s /usr/lib/systemd/user/plasma-env-cleanup.service /usr/lib/systemd/user/plasma-workspace-wayland.target.wants


More information about the Neon-commits mailing list