]>
Commit | Line | Data |
---|---|---|
03b903de | 1 | #!/bin/sh |
2 | # https://kevinlocke.name/bits/2019/07/31/prefer-terminal-for-gpg-pinentry | |
3 | ||
6d54344e | 4 | set -C |
29b45f3c | 5 | gfx="qt gnome gtk-4 gtk-3 gtk-2 gtk bemenu dmenu x11" |
6d54344e | 6 | tty="curses-ss curses tty" |
03b903de | 7 | case "${PINENTRY_USER_DATA-}" in |
8650c486 | 8 | # prefer tty unless USE_TTY is 0 |
9 | *USE_TTY=0*) list="$gfx $tty";; | |
10 | *) list="$tty $gfx";; | |
03b903de | 11 | esac |
12 | ||
13 | for x in $list; do | |
a2a81fa8 | 14 | p=$(command -v "pinentry-$x") |
03b903de | 15 | if [ $? = 0 ]; then |
16 | exec "$p" "$@" | |
17 | fi | |
18 | done | |
19 | ||
29b45f3c | 20 | # fallback |
21 | exec pinentry "$@" | |
22 | ||
03b903de | 23 | echo "No pinentry program found" >&2 |