jobcore/pinentry/pinentry

29 lines
729 B
Text
Raw Permalink Normal View History

2024-07-03 09:56:17 +02:00
#!/bin/bash
2022-03-20 13:19:37 +01:00
2024-07-03 09:56:17 +02:00
# Run user-defined and site-defined pre-exec hooks.
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec ]] && \
. "${XDG_CONFIG_HOME:-$HOME/.config}"/pinentry/preexec
[[ -r /etc/pinentry/preexec ]] && . /etc/pinentry/preexec
2022-03-20 13:19:37 +01:00
2024-07-03 09:56:17 +02:00
# Guess preferred backend based on environment.
backends=(curses tty)
if [[ -n "$DISPLAY" || -n "$WAYLAND_DISPLAY" ]]; then
2024-07-03 09:56:17 +02:00
case "$XDG_CURRENT_DESKTOP" in
KDE|LXQT|LXQt)
backends=(qt qt5 gnome3 gtk curses tty)
;;
*)
backends=(gnome3 gtk qt qt5 curses tty)
;;
esac
fi
2022-03-20 13:19:37 +01:00
2024-07-03 09:56:17 +02:00
for backend in "${backends[@]}"
do
lddout=$(ldd "/usr/bin/pinentry-$backend" 2>/dev/null) || continue
[[ "$lddout" == *'not found'* ]] && continue
exec "/usr/bin/pinentry-$backend" "$@"
done
2022-03-20 13:19:37 +01:00
2024-07-03 09:56:17 +02:00
exit 1