[neon/snap-packaging/plasma-core-desktop] hooks: Simplify session related files into a single one for the plasma session
Kevin Ottens
null at kde.org
Wed Jun 12 22:06:32 BST 2024
Git commit 4d849c5cb6fc8c3f6cd75e8423c7ba99113e3914 by Kevin Ottens.
Committed on 12/06/2024 at 21:05.
Pushed by ervin into branch 'master'.
Simplify session related files into a single one for the plasma session
D +0 -88 hooks/006-add-gdm.chroot
R +87 -11 hooks/006-add-plasma-session.chroot [from: hooks/006-zzz-add-plasma-session.chroot - 053% similarity]
https://invent.kde.org/neon/snap-packaging/plasma-core-desktop/-/commit/4d849c5cb6fc8c3f6cd75e8423c7ba99113e3914
diff --git a/hooks/006-add-gdm.chroot b/hooks/006-add-gdm.chroot
deleted file mode 100755
index e4373ec..0000000
--- a/hooks/006-add-gdm.chroot
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh -x
-
-set -e
-
-export DEBIAN_FRONTEND=noninteractive
-
-# Ensure /proc is available
-mount -t proc proc /proc
-trap 'umount /proc' EXIT
-
-apt install --no-install-recommends -y \
- polkitd \
- xwayland \
- libgl1-mesa-dri \
- locales-all \
- locales \
- xdg-user-dirs \
- pipewire \
- wireplumber \
- pipewire-pulse
-
-# Install a basic Ubuntu session
-apt install --no-install-recommends -y \
- pkexec \
- xdg-desktop-portal
-
-mkdir /var/lib/sddm
-chown sddm:sddm /var/lib/sddm
-
-apt install --no-install-recommends -y \
- sddm \
- sddm-theme-breeze \
- swaybg
-
-# Remove setuid from some executables we're not using
-chmod u-s,g-s /usr/bin/pkexec
-
-# Move display-manager.service symlink out of /etc
-rm /etc/systemd/system/display-manager.service
-ln -s sddm.service /lib/systemd/system/display-manager.service
-# Delay sddm until snapd.seeded and cloud-config are complete
-sed -i '/^Description=/ a # delay until snapd finishes seeding\nAfter=snapd.seeded.service' /lib/systemd/system/sddm.service
-sed -i 's/^ExecStart=\/usr\/bin\/sddm/ExecStart=\/usr\/libexec\/start-sddm.sh/' /lib/systemd/system/sddm.service
-
-# Move SDDM config to writable directory
-mkdir -p /etc/writable/sddm
-cat >/etc/writable/sddm/sddm.conf<<EOF
-[General]
-DisplayServer=wayland
-GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
-
-[Wayland]
-CompositorCommand=kwin_wayland --no-lockscreen --no-global-shortcuts --locale1
-EOF
-ln -s writable/sddm/sddm.conf /etc/sddm.conf
-
-# Remove systemd activation in services managed by
-# plasma-desktop-session snap
-rm -f /usr/lib/systemd/user/pipewire*
-rm -f /usr/lib/systemd/user/wireplumber*
-rm -rf /etc/systemd/user/pipewire*
-rm -f /etc/systemd/user/sockets.target.wants/pipewire*
-rm -f /etc/systemd/user/default.target.wants/pipewire*
-rm -f /usr/lib/systemd/user/org.freedesktop.IBus.session.generic.service
-
-# Disable console-conf, since it interferes with SDDM taking over
-# /dev/tty1. Due to the ExecStartPre/ExecStopPost commands, we can't
-# reliably get rid of it with Conflicts/After
-touch /var/lib/console-conf/complete
-
-# ubuntu init uses AccountsService to create the user account.
-# AccountsService in turn calls /usr/sbin/adduser. Replace that
-# script with a wrapper that adds the --extrausers argument.
-#
-# Unfortunately this does not work for the addusers call to add the
-# user to the sudo group.
-mv /usr/sbin/adduser /usr/sbin/adduser.real
-cat <<\EOF > /usr/sbin/adduser
-#!/bin/sh
-exec /usr/sbin/adduser.real --extrausers "$@"
-EOF
-chmod a+x /usr/sbin/adduser
-
-# accounts-daemon uses systemd to lock down the paths it can write
-# to. That list of paths does not include the extrausers database used
-# by Ubuntu Core.
-sed -i "/^ReadWritePaths=/ a \\ /var/lib/extrausers/ \\\\" \
- /usr/lib/systemd/system/accounts-daemon.service
diff --git a/hooks/006-zzz-add-plasma-session.chroot b/hooks/006-add-plasma-session.chroot
similarity index 53%
rename from hooks/006-zzz-add-plasma-session.chroot
rename to hooks/006-add-plasma-session.chroot
index caccaba..6966d56 100755
--- a/hooks/006-zzz-add-plasma-session.chroot
+++ b/hooks/006-add-plasma-session.chroot
@@ -8,8 +8,30 @@ export DEBIAN_FRONTEND=noninteractive
mount -t proc proc /proc
trap 'umount /proc' EXIT
+apt install --no-install-recommends -y \
+ pkexec \
+ polkitd \
+ xwayland \
+ libgl1-mesa-dri \
+ locales-all \
+ locales \
+ xdg-user-dirs \
+ pipewire \
+ wireplumber \
+ pipewire-pulse
+
+# Remove setuid from some executables we're not using
+chmod u-s,g-s /usr/bin/pkexec
+
+# Needed for SDDM install
+mkdir /var/lib/sddm
+chown sddm:sddm /var/lib/sddm
+
# Install a basic Plasma session
apt install --no-install-recommends -y \
+ sddm \
+ sddm-theme-breeze \
+ swaybg \
plasma-desktop \
kdeplasma-addons \
xwaylandvideobridge \
@@ -49,15 +71,79 @@ apt install --no-install-recommends -y \
speech-dispatcher-espeak-ng \
sound-icons
+# Move display-manager.service symlink out of /etc
+rm /etc/systemd/system/display-manager.service
+ln -s sddm.service /lib/systemd/system/display-manager.service
+
+# Delay sddm until snapd.seeded and cloud-config are complete
+sed -i '/^Description=/ a # delay until snapd finishes seeding\nAfter=snapd.seeded.service' /lib/systemd/system/sddm.service
+sed -i 's/^ExecStart=\/usr\/bin\/sddm/ExecStart=\/usr\/libexec\/start-sddm.sh/' /lib/systemd/system/sddm.service
+
+# Move SDDM config to writable directory
+mkdir -p /etc/writable/sddm
+cat >/etc/writable/sddm/sddm.conf<<EOF
+[General]
+DisplayServer=wayland
+GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell
+
+[Wayland]
+CompositorCommand=kwin_wayland --no-lockscreen --no-global-shortcuts --locale1
+EOF
+ln -s writable/sddm/sddm.conf /etc/sddm.conf
+
+# Prepare a session used only before first user provisioning
+# it gives only access to the ubuntu-core-desktop-init wizard
+mkdir /usr/share/wayland-sessions-bootstrap
+cat >/usr/share/wayland-sessions-bootstrap/ubuntu-init-session.desktop<<EOF
+[Desktop Entry]
+Name=Ubuntu Init
+Comment=This session only start the first time wizard
+Exec=/usr/libexec/start-ubuntu-init-session.sh
+Type=Application
+EOF
+
# Remove regular Plasma sessions, so only confined session is available
rm -f /usr/share/wayland-sessions/plasma.desktop
rm -f /usr/share/xsessions/plasmax11.desktop
+# Disable console-conf, since it interferes with SDDM taking over
+# /dev/tty1. Due to the ExecStartPre/ExecStopPost commands, we can't
+# reliably get rid of it with Conflicts/After
+touch /var/lib/console-conf/complete
+
+# Remove systemd activation in services managed by
+# plasma-desktop-session snap
+rm -f /usr/lib/systemd/user/pipewire*
+rm -f /usr/lib/systemd/user/wireplumber*
+rm -rf /etc/systemd/user/pipewire*
+rm -f /etc/systemd/user/sockets.target.wants/pipewire*
+rm -f /etc/systemd/user/default.target.wants/pipewire*
+rm -f /usr/lib/systemd/user/org.freedesktop.IBus.session.generic.service
+
# Remove D-Bus service activation files provided by
# the session snap.
rm /usr/share/dbus-1/services/org.freedesktop.impl.portal.desktop.kde.service
rm /usr/lib/systemd/user/plasma-xdg-desktop-portal-kde.service
+# ubuntu init uses AccountsService to create the user account.
+# AccountsService in turn calls /usr/sbin/adduser. Replace that
+# script with a wrapper that adds the --extrausers argument.
+#
+# Unfortunately this does not work for the addusers call to add the
+# user to the sudo group.
+mv /usr/sbin/adduser /usr/sbin/adduser.real
+cat <<\EOF > /usr/sbin/adduser
+#!/bin/sh
+exec /usr/sbin/adduser.real --extrausers "$@"
+EOF
+chmod a+x /usr/sbin/adduser
+
+# accounts-daemon uses systemd to lock down the paths it can write
+# to. That list of paths does not include the extrausers database used
+# by Ubuntu Core.
+sed -i "/^ReadWritePaths=/ a \\ /var/lib/extrausers/ \\\\" \
+ /usr/lib/systemd/system/accounts-daemon.service
+
# Remove extra backends for discover.
rm /usr/lib/x86_64-linux-gnu/qt6/plugins/discover/packagekit-backend.so
rm /usr/lib/x86_64-linux-gnu/qt6/plugins/discover/fwupd-backend.so
@@ -65,6 +151,7 @@ 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
+# Remove NetworkManager from the session snap.
rm /usr/sbin/NetworkManager
rm /usr/lib/systemd/system/NetworkManager*.service
@@ -86,14 +173,3 @@ 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
-
-# Prepare a session used only before first user provisioning
-# it gives only access to the ubuntu-core-desktop-init wizard
-mkdir /usr/share/wayland-sessions-bootstrap
-cat >/usr/share/wayland-sessions-bootstrap/ubuntu-init-session.desktop<<EOF
-[Desktop Entry]
-Name=Ubuntu Init
-Comment=This session only start the first time wizard
-Exec=/usr/libexec/start-ubuntu-init-session.sh
-Type=Application
-EOF
More information about the Neon-commits
mailing list