#!/bin/sh

if [ -n "$PINENTRY_PROGRAM" ]; then
	exec $PINENTRY_PROGRAM "$@"
elif [ -z "$DISPLAY" ]; then
	exec /usr/bin/pinentry-curses "$@"
elif [ -x /usr/bin/pinentry-gtk-2 ]; then
	exec /usr/bin/pinentry-gtk-2 "$@"
elif [ -x /usr/bin/pinentry-gtk ]; then
	exec /usr/bin/pinentry-gtk "$@"
elif [ -x /usr/bin/pinentry-qt4 ]; then
	exec /usr/bin/pinentry-qt4 "$@"
elif [ -x /usr/bin/pinentry-qt ]; then
	exec /usr/bin/pinentry-qt "$@"
else
	exec /usr/bin/pinentry-curses "$@"
fi
