From 6b6c4d2daff60370b9ae1c483658acff9ffef1bf Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 01:39:19 +0000 Subject: [PATCH] fix(install): stop libblockdev matching the desktop-environment check dpkg -l | grep -E '^ii.*kde' searched the description column too, so unrelated packages (libblockdev-*) set DESKTOP_DETECTED on Raspberry Pi OS Lite. Match on the installed package name only, anchored. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01VZNWFWprcFYGfuf1JAyrBJ --- first_time_install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/first_time_install.sh b/first_time_install.sh index 65cd66fc..b83eea7b 100755 --- a/first_time_install.sh +++ b/first_time_install.sh @@ -91,7 +91,10 @@ 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". - if dpkg -l | grep -E "^ii.*raspberrypi-ui-mods|^ii.*lxde|^ii.*xfce|^ii.*gnome|^ii.*kde" >/dev/null; then + # Match on the package name only, anchored: `dpkg -l` lines include the + # description, so an unanchored ".*kde" matched libblockdev-* on Lite. + 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 DESKTOP_DETECTED=1 fi if systemctl list-units --type=service --state=running 2>/dev/null | grep -qE "lightdm|gdm3|sddm|lxdm"; then