select pinentry-curses/qt depending on situation

Petr Uzel petr.uzel at
Sun Nov 23 17:21:11 CET 2008

Hey list!

What is the best way (if any) to select which pinentry (-curses/-qt/-gtk) to
run, depending on situation, i.e. whether X is running and whether we have tty.

What I want is to run pinentry-curses if there is tty (e.g. gpg in virtual
console), and 'graphical' pinentry otherwise (e.g. signing mail in kmail).

Now, I have a shell script named /usr/bin/pinentry, that tries to determine
which pinentry to run and then executes it. The problem is that it can only use
command line options that gpg-agent passes to pinentry. This options either
does or doesn't contain --display option, depending on whether X is running.
The rest of options (namely --ttyname) is passed to pinentry via assuan
protocol, which obviously can not be used in the process of selecting proper
pinentry. Without ttyname I can't distinguish whether I have virtual terminal
or not (calling tty -s in pinentry script does not work).

I have two questions:

1) Is there any way how to pass ttyname (and possibly other options) to
pinentry via command line arguments instead of assuan protocol?

2) More generally, is there any better way how to run various versions of
pinentry depending on situation ?

Thanks in advance,

Best regards / s pozdravem

Petr Uzel, Packages maintainer
SUSE LINUX, s.r.o.                          e-mail: puzel at
Lihovarská 1060/12                          tel: +420 284 028 964
190 00 Prague 9                             fax: +420 284 028 951
Czech Republic                    

More information about the Gnupg-devel mailing list