#!/bin/sh # https://kevinlocke.name/bits/2019/07/31/prefer-terminal-for-gpg-pinentry set -Ce gfx="gnome gtk-2 gtk qt x11" tty="curses tty" case "${PINENTRY_USER_DATA-}" in # prefer tty unless USE_TTY is 0 *USE_TTY=0*) list="$gfx $tty";; *) list="$tty $gfx";; esac for x in $list; do p=`which "pinentry-$x"` 2>/dev/null if [ $? = 0 ]; then exec "$p" "$@" fi done echo "No pinentry program found" >&2