KDE: add bookworm Wayland gate and release-aware SDDM session probe

Bookworm's plasma-workspace ships only the X11 session; the Wayland
session (plasmawayland.desktop) lives in the separate
plasma-workspace-wayland package (a Recommends of plasma-desktop, now
listed explicitly for the same determinism as the explicit sddm). The
package does not exist on trixie, where plasma-workspace integrates
Wayland natively, so naming it off-bookworm would fail the apt
transaction: resolve it once per installer with _kde_wayland_pkg() and
build the package list in a conditional array so neither the pre-apply
summary nor the apt command ever shows an empty argument. Also correct
the header comment: bookworm still defaults SDDM to the X11 session,
while trixie makes Wayland primary (plasma.desktop in
wayland-sessions) with plasmax11.desktop as the X11 fallback.

Replace the hard-coded SDDM autologin session cascade with an
existence-based ordered probe (_sddm_session_candidates) that prefers
Wayland across releases, keeps the LXQt sessions last for when the
module starts offering LXQt, and reads its session roots from
SESSION_DIR_WAYLAND / SESSION_DIR_X11 for hermetic testing.

Extend tests/desktops.bats with 13 offline tests: gate helper output on
bookworm/trixie, captured apt commands for both installers, summary
content (no empty package line), and the ordered session probe against
fixture trees.
This commit is contained in:
stornic56
2026-10-17 17:10:50 -05:00
parent 3f7535f5d0
commit afac6c7876
3 changed files with 241 additions and 17 deletions
+24 -9
View File
@@ -299,6 +299,29 @@ configure_gdm3() {
done
}
# Ordered session candidates for SDDM autologin:
# Wayland first, then X11, per release. Existence
# decides (no codename gates). The LXQt sessions
# stay last for when the module starts offering LXQt.
_sddm_session_candidates() {
local wayland_dir="${SESSION_DIR_WAYLAND:-/usr/share/wayland-sessions}"
local x11_dir="${SESSION_DIR_X11:-/usr/share/xsessions}"
local candidate
for candidate in \
"$wayland_dir/plasmawayland.desktop" \
"$wayland_dir/plasma.desktop" \
"$x11_dir/plasma.desktop" \
"$x11_dir/plasmax11.desktop" \
"$wayland_dir/lxqt-wayland.desktop" \
"$x11_dir/lxqt.desktop"; do
if [ -f "$candidate" ]; then
basename "$candidate" .desktop
return 0
fi
done
return 0
}
configure_sddm() {
while true; do
local choice
@@ -317,19 +340,11 @@ configure_sddm() {
;;
2)
local sddm_session=""
sddm_session=$(_sddm_session_candidates)
local sddm_user="${SUDO_USER:-}"
if [ -z "$sddm_user" ] || [ "$sddm_user" = "root" ]; then
sddm_user=$(awk -F: '$3>=1000 && $3<65534 {print $1}' /etc/passwd | head -1)
fi
if [ -f /usr/share/wayland-sessions/plasmawayland.desktop ]; then
sddm_session="plasmawayland"
elif [ -f /usr/share/wayland-sessions/lxqt-wayland.desktop ]; then
sddm_session="lxqt-wayland"
elif [ -f /usr/share/xsessions/plasma.desktop ]; then
sddm_session="plasma"
elif [ -f /usr/share/xsessions/lxqt.desktop ]; then
sddm_session="lxqt"
fi
sudo mkdir -p /etc/sddm.conf.d
cat <<EOF | sudo tee /etc/sddm.conf.d/autologin.conf >/dev/null
[Autologin]