commit b5347107088bd9ff4b36a396a0ecacef377fd00c
parent f259a4fe71987b5db60ac206bce86b2c69cf2ddc
Author: Sascha Silbe <sascha-pgp@silbe.org>
Date: Tue, 18 Jan 2011 19:20:21 +0100
prefer gpg2 (GnuPG 2.x) over gpg (GnuPG 1.x)
Since 1.9.14 GnuPG can automatically start gpg-agent if it's not already
running (using a well-known socket location). When using GnuPG 1.x gpg-agent
needs to already be running at the time sup is started because the socket
location is random and passed via environment variables.
Autostarting gpg-agent is particularly convenient when using sup via ssh
as gpg-agent would need to be started manually (for local X sessions OTOH
it's often started automatically by distro scripts).
Signed-off-by: Sascha Silbe
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -48,6 +48,11 @@ EOS
GPGME.check_version({:protocol => GPGME::PROTOCOL_OpenPGP})
rescue NameError, GPGME::Error
@gpgme_present = false
+ return
+ end
+
+ if (bin = `which gpg2`.chomp) =~ /\S/
+ GPGME.set_engine_info GPGME::PROTOCOL_OpenPGP, bin, nil
end
end