[neon/snap-packaging/plasma-core-desktop] /: Switch display manager to SDDM
Kevin Ottens
null at kde.org
Thu Jun 6 16:45:54 BST 2024
Git commit 4029ee703f291ff246f91b600da80b9920a377a9 by Kevin Ottens.
Committed on 06/06/2024 at 14:59.
Pushed by ervin into branch 'master'.
Switch display manager to SDDM
A +8 -0 hook-tests/006-add-plasma-session.test
M +4 -4 hooks/000-provide-uids-gids.chroot
M +21 -7 hooks/006-add-gdm.chroot
M +11 -0 hooks/006-zzz-add-plasma-session.chroot
M +4 -3 hooks/990-ensure-uids-gids.chroot
M +1 -0 static/etc/system-image/writable-paths
A +33 -0 static/usr/libexec/start-sddm.sh
A +3 -0 static/usr/libexec/start-swaybg.sh
A +8 -0 static/usr/libexec/start-ubuntu-init-session.sh
https://invent.kde.org/neon/snap-packaging/plasma-core-desktop/-/commit/4029ee703f291ff246f91b600da80b9920a377a9
diff --git a/hook-tests/006-add-plasma-session.test b/hook-tests/006-add-plasma-session.test
new file mode 100755
index 0000000..532766a
--- /dev/null
+++ b/hook-tests/006-add-plasma-session.test
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+if [ ! -f usr/share/wallpapers/Next/contents/images/1920x1200.png ]; then
+ echo "wallpaper displayed during system provisioning is missing"
+ exit 1
+fi
diff --git a/hooks/000-provide-uids-gids.chroot b/hooks/000-provide-uids-gids.chroot
index 763c63b..977fd49 100755
--- a/hooks/000-provide-uids-gids.chroot
+++ b/hooks/000-provide-uids-gids.chroot
@@ -119,7 +119,6 @@ syslog:x:108:114:Reserved:/home/syslog:/bin/false
dnsmasq:x:109:65534:Reserved:/var/lib/misc:/bin/false
tss:x:110:116:Reserved:/var/lib/tpm:/bin/false
geoclue:x:111:120::/var/lib/geoclue:/bin/false
-gdm:x:112:121:Gnome Display Manager:/var/lib/gdm3:/bin/false
colord:x:113:123:colord colour management daemon:/var/lib/colord:/usr/sbin/nologin
gnome-initial-setup:x:114:65534::/run/gnome-initial-setup/:/bin/false
rtkit:x:115:124:RealtimeKit,,,:/proc:/usr/sbin/nologin
@@ -127,6 +126,7 @@ pipewire:x:116:125:Pipewire,,,:/proc:/usr/sbin/nologin
polkitd:x:117:126:polkit:/nonexistent:/usr/sbin/nologin
systemd-journal:x:118:106:Reserved:/run/systemd:/bin/false
speech-dispatcher:x:107:1005:Speech Dispatcher,,,:/run/speech-dispatcher:/bin/false
+sddm:x:119:113:Simple Desktop Display Manager:/var/lib/sddm:/bin/false
EOF
cp /etc/passwd /etc/passwd.orig # We make a copy for a later sanity-compare
@@ -163,12 +163,12 @@ syslog:*:16521:0:99999:7:::
dnsmasq:*:16644:0:99999:7:::
tss:*:16701:0:99999:7:::
geoclue:*:18459:0:99999:7:::
-gdm:*:18459:0:99999:7:::
colord:*:18495:0:99999:7:::
gnome-initial-setup:*:18495:0:99999:7:::
rtkit:*:19390:0:99999:7:::
polkitd:!*:19635:::::
speech-dispatcher:!:19835:0:99999:7:::
+sddm:*:19873:0:99999:7:::
EOF
cp /etc/shadow /etc/shadow.orig # We make a copy for a later sanity-compare
@@ -232,12 +232,12 @@ render:x:117:
sgx:x:119:
_ssh:x:118:
geoclue:x:120:
-gdm:x:121:
scanner:x:122:
colord:x:123:
rtkit:x:124:
pipewire:x:125:
polkitd:x:126:
+sddm:x:113:
EOF
cp /etc/group /etc/group.orig # We make a copy for a later sanity-compare
@@ -301,11 +301,11 @@ render:!::
sgx:!::
_ssh:!::
geoclue:!::
-gdm:!::
scanner:!::
colord:!::
pipewire:!::
rtkit:!::
polkitd:!*::
+sddm:!::
EOF
cp /etc/gshadow /etc/gshadow.orig # We make a copy for a later sanity-compare
diff --git a/hooks/006-add-gdm.chroot b/hooks/006-add-gdm.chroot
index 30fea88..77dcced 100755
--- a/hooks/006-add-gdm.chroot
+++ b/hooks/006-add-gdm.chroot
@@ -9,7 +9,6 @@ mount -t proc proc /proc
trap 'umount /proc' EXIT
apt install --no-install-recommends -y \
- gdm3 \
polkitd \
xwayland \
libgl1-mesa-dri \
@@ -59,6 +58,14 @@ apt install --no-install-recommends -y \
inotify-tools \
alsa-ucm-conf
+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
@@ -67,9 +74,16 @@ rm /usr/share/xsessions/ubuntu.desktop
# Move display-manager.service symlink out of /etc
rm /etc/systemd/system/display-manager.service
-ln -s gdm.service /lib/systemd/system/display-manager.service
-# Delay gdm until snapd.seeded and cloud-config are complete
-sed -i '/^Description=/ a # delay until snapd finishes seeding\nAfter=snapd.seeded.service' /lib/systemd/system/gdm.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
+touch /etc/writable/sddm/sddm.conf
+ln -s writable/sddm/sddm.conf /etc/sddm.conf
+
# Remove D-Bus service activation files provided by
# ubuntu-desktop-session snap.
@@ -148,9 +162,9 @@ rm -f /usr/share/wayland-sessions/ubuntu-wayland.desktop
rm -f /usr/share/xsessions/ubuntu-xorg.desktop
# Move GDM config to writable directory
-mkdir -p /etc/writable/gdm3
-mv /etc/gdm3/custom.conf /etc/writable/gdm3/custom.conf
-ln -s ../writable/gdm3/custom.conf /etc/gdm3/custom.conf
+#mkdir -p /etc/writable/gdm3
+#mv /etc/gdm3/custom.conf /etc/writable/gdm3/custom.conf
+#ln -s ../writable/gdm3/custom.conf /etc/gdm3/custom.conf
# Disable gnome-shell systemd
rm -f /usr/lib/systemd/user/org.gnome.Shell*
diff --git a/hooks/006-zzz-add-plasma-session.chroot b/hooks/006-zzz-add-plasma-session.chroot
index 861b782..9d15417 100755
--- a/hooks/006-zzz-add-plasma-session.chroot
+++ b/hooks/006-zzz-add-plasma-session.chroot
@@ -83,3 +83,14 @@ 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
diff --git a/hooks/990-ensure-uids-gids.chroot b/hooks/990-ensure-uids-gids.chroot
index 90d2bf6..b46f2c9 100755
--- a/hooks/990-ensure-uids-gids.chroot
+++ b/hooks/990-ensure-uids-gids.chroot
@@ -29,9 +29,10 @@ rc=$?; [ "$rc" != "0" ] && MISMATCH=1
#cut -d: -f3 /etc/passwd | grep -q 107
#rc=$?; [ "$rc" = "0" ] && MISMATCH=1
-echo "Ensure no group 113 (ex-docker)"
-cut -d: -f3 /etc/group | grep -q 113
-rc=$?; [ "$rc" = "0" ] && MISMATCH=1
+# This is sddm now
+#echo "Ensure no group 113 (ex-docker)"
+#cut -d: -f3 /etc/group | grep -q 113
+#rc=$?; [ "$rc" = "0" ] && MISMATCH=1
if [ -n "$MISMATCH" ]; then
echo "There were changes to the password database."
diff --git a/static/etc/system-image/writable-paths b/static/etc/system-image/writable-paths
index f179802..103c054 100644
--- a/static/etc/system-image/writable-paths
+++ b/static/etc/system-image/writable-paths
@@ -67,6 +67,7 @@
/etc/update-motd.d auto persistent transition none
/var/lib/AccountsService auto persistent transition none
/var/lib/gdm3 auto persistent transition none
+/var/lib/sddm auto persistent transition none
/usr/share/wayland-sessions auto persistent transition none
/usr/share/polkit-1 auto persistent transition none
/var/lib/colord auto persistent transition none
diff --git a/static/usr/libexec/start-sddm.sh b/static/usr/libexec/start-sddm.sh
new file mode 100755
index 0000000..a415f69
--- /dev/null
+++ b/static/usr/libexec/start-sddm.sh
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+SDDM_CONF=/etc/writable/sddm/sddm.conf
+
+SDDM=/usr/bin/sddm
+UBUNTU_INIT=/snap/ubuntu-core-desktop-init/current/bin/ubuntu_init
+
+if [ -f $SDDM_CONF.orig ] ; then
+ mv $SDDM_CONF.orig $SDDM_CONF
+fi
+
+if [ ! -f $UBUNTU_INIT ] ; then
+ echo "Didn't find ubuntu_init, bailing out"
+ exec $SDDM
+ exit 0
+fi
+
+user_count=`grep '/home/' /var/lib/extrausers/passwd | wc -l`
+
+if [ $user_count -lt 1 ] ; then
+ mv $SDDM_CONF $SDDM_CONF.orig
+ cat >$SDDM_CONF<<EOF
+[Wayland]
+SessionDir=/usr/share/wayland-sessions-bootstrap
+
+[Autologin]
+User=root
+Session=ubuntu-init-session
+Relogin=true
+EOF
+fi
+
+exec $SDDM
diff --git a/static/usr/libexec/start-swaybg.sh b/static/usr/libexec/start-swaybg.sh
new file mode 100755
index 0000000..58d965f
--- /dev/null
+++ b/static/usr/libexec/start-swaybg.sh
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+swaybg --mode fill --image /usr/share/wallpapers/Next/contents/images/1920x1200.png
diff --git a/static/usr/libexec/start-ubuntu-init-session.sh b/static/usr/libexec/start-ubuntu-init-session.sh
new file mode 100755
index 0000000..a283d7e
--- /dev/null
+++ b/static/usr/libexec/start-ubuntu-init-session.sh
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+UBUNTU_INIT=/snap/ubuntu-core-desktop-init/current/bin/ubuntu_init
+START_SWAYBG=/usr/libexec/start-swaybg.sh
+
+kwin_wayland --no-lockscreen --exit-with-session $UBUNTU_INIT $START_SWAYBG
+systemctl restart sddm
+
More information about the Neon-commits
mailing list