[pass] [PATCH] GPG improvements

Matthieu Weber mweber at free.fr
Sat Mar 22 20:32:08 CET 2014


On Fri 21.03.2014 at 10:06:21PM -0600, Jason A. Donenfeld wrote:
> This seems to have some X_SELECTION business in it.

Sorry for that, it seems I made the patch against the wrong branch :(

> > +[[ -n `which gpg2` ]] && GPG=gpg2
> 
> This should be [[ -n $(which gpg2) ]]

Fixed.

> > +[[ -n "$GPG_AGENT_INFO" ]] && GPG_OPTS="$GPG_OPTS --batch"
> 
> So I like that. It makes perfect sense if --batch is *only* useful
> when there's a gpg agent. But IIRC, can't gpg2 operate in --batch mode
> and talk to the agent without needing that env var?

After a few experiments, it seems that gpg2 --batch works even without
the GPG_AGENT_INFO environment variable. It uses pinentry to request the
secret key's passphrase, but requests the passphrase every time it is
called. In any case that's good enough I guess.

> Wouldn't an easier
> way to do this be:
> 
> if [[ -n $(which gpg2) ]]; then
>    GPG=gpg2
>    GPG_OPTS="$GPG_OPTS --batch"
> fi

I settled for:

GPG=gpg
if [[ -n $(which gpg2) ]]; then
  GPG=gpg2
  GPG_OPTS="$GPG_OPTS --batch"
elif [[ -n "$GPG_AGENT_INFO" ]]; then
  GPG_OPTS="$GPG_OPTS --batch"
fi

The patch will follow soon.

Matthieu
-- 
 (~._.~)            Matthieu Weber - mweber at free.fr              (~._.~)
  ( ? )                http://weber.fi.eu.org/                    ( ? ) 
 ()- -()          public key id : 0x85CB340EFCD5E0B3             ()- -()
 (_)-(_) "Humor ist, wenn man trotzdem lacht (Otto J. Bierbaum)" (_)-(_)


More information about the Password-Store mailing list