#!/bin/sh
# Runs cont8nuum's own polkit authentication agent (c8-polkit, from
# c8-shell, beside this script in libexec), or else the first other one
# that is installed. Any of them works on cont8nuum; they just look
# different. c8-polkit exits 3 when it can't be the agent here.
here=$(dirname "$(readlink -f "$0")")
for own in "$here/c8-polkit" /usr/local/libexec/c8-polkit /usr/libexec/c8-polkit; do
if [ -x "$own" ]; then
"$own"
status=$?
[ "$status" -eq 3 ] || exit "$status"
break
fi
done
for agent in \
/usr/libexec/polkit-kde-authentication-agent-1 \
/usr/lib/polkit-kde-authentication-agent-1 \
/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1 \
/usr/libexec/polkit-gnome-authentication-agent-1 \
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 \
/usr/libexec/polkit-mate-authentication-agent-1 \
/usr/lib/mate-polkit/polkit-mate-authentication-agent-1 \
/usr/libexec/hyprpolkitagent \
/usr/lib/hyprpolkitagent/hyprpolkitagent \
lxqt-policykit-agent \
lxpolkit
do
if command -v "$agent" >/dev/null 2>&1; then
exec "$agent"
fi
done
echo "c8-polkit-agent: no polkit authentication agent installed;" \
"apps can't ask for your password" >&2
exit 0