From bfa279da9ba3c8856a74c653721df0526486a99e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dylan=20A=C3=AFssi?= <dylan.aissi@collabora.com>
Date: Wed, 24 Jul 2024 17:43:15 +0200
Subject: [PATCH] polkit-parsing.sh: fix location of polkitd for Bullseye and
 Bookworm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
---
 common/polkit-parsing.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/common/polkit-parsing.sh b/common/polkit-parsing.sh
index 9f3fccc..38b4802 100755
--- a/common/polkit-parsing.sh
+++ b/common/polkit-parsing.sh
@@ -23,12 +23,17 @@ trap cleanup EXIT
 
 # Restart polkitd to enable debug support (the standard systemd .service file
 # starts it with --no-debug)
-if [ -e /usr/lib/policykit-1/polkitd ]; then
-	# Debian jessie; Ubuntu vivid; Apertis 15.03
-	polkitd=/usr/lib/policykit-1/polkitd
-else
-	# Debian experimental as of 2015-04; Apertis 15.06
+if [ -e /usr/libexec/polkitd ]; then
+	# Debian Bullseye, Apertis v2022 and v2023
+	polkitd=/usr/libexec/polkitd
+elif [ -e /usr/lib/polkit-1/polkitd ]; then
+	# Debian Bookworm, Apertis v2024+
 	polkitd=/usr/lib/polkit-1/polkitd
+else
+	# polkitd is called with errexit set to "off", then
+	# we have to fail before if the binary is not available.
+	echo "The polkitd binary was not found!"
+	exit 1
 fi
 
 ( set +e; sudo ${polkitd} --replace 2>&1 ) | sed 's/^/# /' | tee $TMPFILE &
-- 
GitLab