]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # https://kevinlocke.name/bits/2019/07/31/prefer-terminal-for-gpg-pinentry | |
3 | ||
4 | set -Ce | |
5 | gfx="gnome gtk-2 gtk qt x11" | |
6 | tty="curses tty" | |
7 | case "${PINENTRY_USER_DATA-}" in | |
8 | # prefer tty unless USE_TTY is 0 | |
9 | *USE_TTY=0*) list="$gfx $tty";; | |
10 | *) list="$tty $gfx";; | |
11 | esac | |
12 | ||
13 | for x in $list; do | |
14 | p=`which "pinentry-$x"` 2>/dev/null | |
15 | if [ $? = 0 ]; then | |
16 | exec "$p" "$@" | |
17 | fi | |
18 | done | |
19 | ||
20 | echo "No pinentry program found" >&2 |