From 4411bb5760ab90c5dfa381408e86d5bacc8baece Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 12:53:23 +0000 Subject: [PATCH] fix(install): detect desktops by their metapackages, not name prefixes The Lite check matched any installed package starting with gnome/kde/ xfce/lxde, so standalone parts (gnome-keyring, xfce4-terminal, lxde-icon-theme) rejected a Lite system. Match whole names of desktop metapackages and session managers instead. Also catch desktops the prefixes missed: Raspberry Pi OS Trixie replaced raspberrypi-ui-mods with rpd-wayland-core / rpd-x-core, Debian tasksel desktops (task-*-desktop), and multi-arch names (plasma-workspace:arm64). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VZNWFWprcFYGfuf1JAyrBJ --- first_time_install.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/first_time_install.sh b/first_time_install.sh index ea494c12..29105294 100755 --- a/first_time_install.sh +++ b/first_time_install.sh @@ -91,11 +91,16 @@ if [ -r "$LM_OS_RELEASE_FILE" ]; then DESKTOP_DETECTED=0 # grep without -q: -q exits at the first match, dpkg then dies of SIGPIPE, # and pipefail turns a found desktop into "not found". - # Match installed package names from their start: the unanchored ".*kde" - # matched mid-word (libblockdev-* = "bloc-kde-v") on Lite, and `dpkg -l` - # lines also carry descriptions that could match. + # Desktop metapackages and session managers, matched as whole installed + # package names: an unanchored ".*kde" matched libblockdev-* ("bloc-kde-v"), + # and a "gnome" prefix matched standalone parts such as gnome-keyring. + # Trixie replaced raspberrypi-ui-mods with the rpd-*-core metapackages. + DESKTOP_PACKAGES='raspberrypi-ui-mods|rpd-wayland-core|rpd-x-core' + DESKTOP_PACKAGES+='|lxde|lxde-core|lxsession|xfce4|xfce4-session' + DESKTOP_PACKAGES+='|gnome-shell|gnome-session|kde-plasma-desktop|plasma-desktop' + DESKTOP_PACKAGES+='|plasma-workspace|task-desktop|task-[a-z0-9]+-desktop' if dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' 2>/dev/null \ - | grep -E "^ii +(raspberrypi-ui-mods|lxde|xfce|gnome|kde)" >/dev/null; then + | grep -E "^ii +(${DESKTOP_PACKAGES})(:[a-z0-9]+)?$" >/dev/null; then DESKTOP_DETECTED=1 fi if systemctl list-units --type=service --state=running 2>/dev/null | grep -qE "lightdm|gdm3|sddm|lxdm"; then