From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.229.71 with SMTP id jh7cs486212icb; Tue, 11 Jan 2011 11:21:45 -0800 (PST) Received: by 10.224.74.14 with SMTP id s14mr28279615qaj.370.1294773704815; Tue, 11 Jan 2011 11:21:44 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id f10si53778372qcq.108.2011.01.11.11.21.44; Tue, 11 Jan 2011 11:21:44 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 649D219782DC; Tue, 11 Jan 2011 14:21:44 -0500 (EST) Received: from smtp.chost.de (setoy.chost.de [217.160.209.225]) by rubyforge.org (Postfix) with ESMTP id 2A62A18581B2 for ; Tue, 11 Jan 2011 14:00:01 -0500 (EST) Received: (qmail 28439 invoked by uid 5015); 11 Jan 2011 19:00:10 -0000 Received: (nullmailer pid 31414 invoked by uid 8193); Tue, 11 Jan 2011 19:00:00 -0000 Received: (nullmailer pid 1622 invoked by uid 8193); Tue, 11 Jan 2011 18:59:59 -0000 From: Sascha Silbe To: sup-devel Date: Tue, 11 Jan 2011 19:59:43 +0100 Message-Id: <1294772383-1585-1-git-send-email-sascha-pgp@silbe.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1294759313-653-1-git-send-email-sascha-pgp@silbe.org> References: <1294759313-653-1-git-send-email-sascha-pgp@silbe.org> Mail-Followup-To: Subject: [sup-devel] [PATCH v2] prefer gpg2 (GnuPG 2.x) over gpg (GnuPG 1.x) X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sascha Silbe , Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org 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 --- lib/sup/crypto.rb | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) v1->v2: fallback to gpg if gpg2 is not available diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb index 537745d..16ebaf9 100644 --- a/lib/sup/crypto.rb +++ b/lib/sup/crypto.rb @@ -25,9 +25,10 @@ EOS def initialize @mutex = Mutex.new - bin = `which gpg`.chomp - @cmd = case bin - when /\S/ + @cmd = if (bin = `which gpg2`.chomp) =~ /\S/ + debug "crypto: detected gpg binary in #{bin}" + "#{bin} --quiet --batch --no-verbose --logger-fd 1 --use-agent" + elsif (bin = `which gpg`.chomp) =~ /\S/ debug "crypto: detected gpg binary in #{bin}" "#{bin} --quiet --batch --no-verbose --logger-fd 1 --use-agent" else -- 1.7.2.3 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel