Skip to content
Snippets Groups Projects

More polkit-parsing.sh cleanup

Merged Dylan Aïssi requested to merge wip/daissi/fix-polkit-parsing into apertis/v2025pre
All threads resolved!
Files
2
+ 12
4
@@ -7,10 +7,11 @@ TMPFILE=`mktemp`
cleanup () {
rv=$?
set -e
set -x
sudo pkill -9 polkitd
# polkitd should be killed in the script body, so in that case the
# following command will fail (hence the ||true). But if an error occurs
# before the pkill is reached, then we still need to kill it here.
sudo pkill -9 polkitd >/dev/null 2>&1 || true
rm -f "$TMPFILE"
# Be nice and leave polkit running as normal.
@@ -35,9 +36,16 @@ fi
( set +e; sudo ${polkitd} --replace 2>&1 ) | sed 's/^/# /' | tee $TMPFILE &
# Wait for it to start.
gdbus wait --address unix:path=/var/run/dbus/system_bus_socket \
gdbus wait --address unix:path=/run/dbus/system_bus_socket \
org.freedesktop.PolicyKit1
# For unknown reasons (race conditions?), pkaction randomly fails with:
# "Error enumerating actions: GDBus.Error:org.freedesktop.DBus.Error.NoReply:
# Message recipient disconnected from message bus without replying"
# So, to mitigate this issue give it some more time to be ready,
# although this should be the aim of "gdbus wait" above.
sleep 5
# Query for actions, which forces polkit to parse all the policy files and
# output warnings if any are malformed.
#
Loading