<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] Remove absolute paths from gpg.rc



On Thursday, 15 March 2007 at 17:40, Christoph Berg wrote:
> # HG changeset patch
> # User Christoph Berg <cb@xxxxxxxx>
> # Date 1173976786 -3600
> # Node ID 50bc0121e4a8b1c638fa56451d477a7cf3b1cbce
> # Parent  5c2f2072a4dbfa69f2db7a93ae52b984f65e165c
> Remove absolute paths.

How about this as a compromise?
# HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxxx>
# Date 1174067159 25200
# Node ID b60abb6d77e2c28a1f46ed22da36c2840c000f8f
# Parent  08f9bb4b781028ad621d1debfee80c25be4dd81f
Add --with-gpg and use it to set the path to gpg in gpg.rc

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -22,6 +22,7 @@
 ^reldate\.h$
 ^smime_keys$
 ^stamp-doc-rc$
+^contrib/gpg\.rc$
 ^doc/instdoc$
 ^doc/manual\.(txt|xml)$
 ^doc/mutt\.1$
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -138,6 +138,23 @@ AC_ARG_ENABLE(pgp, AC_HELP_STRING([--dis
                 have_pgp=no
         fi
 ])
+
+AC_ARG_WITH([gpg], AC_HELP_STRING([--with-gpg[=PATH]], [Where GPG is 
installed]))
+
+if test -n "$with_gpg" -a "$with_gpg" != yes
+then
+   AC_MSG_CHECKING([for gpg])
+   GPG="$with_gpg"
+   AC_SUBST([GPG])
+   if test -x "$with_gpg"
+   then
+     AC_MSG_RESULT([$GPG])
+   else
+     AC_MSG_WARN([$with_gpg is not executable!])
+   fi
+else
+  AC_PATH_PROG([GPG], [gpg], [/usr/bin/gpg], 
[/usr/local/bin:/usr/bin:/sw/bin:/opt/local/bin])
+fi
 
 if test x$have_pgp != xno ; then
         AC_DEFINE(CRYPT_BACKEND_CLASSIC_PGP,1, [Define if you want classic PGP 
support.])
@@ -1163,7 +1180,7 @@ AC_SUBST(DSLROOT)
 AC_SUBST(DSLROOT)
 
 AC_OUTPUT(Makefile intl/Makefile m4/Makefile
-        po/Makefile.in doc/Makefile contrib/Makefile
+        po/Makefile.in doc/Makefile contrib/Makefile contrib/gpg.rc
         muttbug.sh
         imap/Makefile
         doc/instdoc.sh)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -2,12 +2,12 @@
 
 subdir = contrib
 
-SAMPLES = Mush.rc Pine.rc gpg.rc pgp2.rc pgp5.rc pgp6.rc Tin.rc \
+SAMPLES = Mush.rc Pine.rc pgp2.rc pgp5.rc pgp6.rc Tin.rc \
        sample.muttrc  sample.mailcap sample.muttrc-tlr \
        colors.default colors.linux smime.rc \
        ca-bundle.crt smime_keys_test.pl mutt_xtitle
 
-EXTRA_DIST = language.txt language50.txt  \
+EXTRA_DIST = gpg.rc.in language.txt language50.txt  \
        patch.slang-1.2.2.keypad.1      \
        $(SAMPLES) \
        iconv/README \
@@ -18,6 +18,7 @@ install-data-local:
        for f in $(SAMPLES) ; do \
                $(INSTALL) -m 644 $(srcdir)/$$f $(DESTDIR)$(docdir)/samples ;   
\
        done
+       $(INSTALL) -m 644 gpg.rc $(DESTDIR)$(docdir)/samples
        for f in $(srcdir)/iconv/*.rc ; do                                      
\
                $(INSTALL) -m 644 $$f $(DESTDIR)$(docdir)/samples/iconv   ;     
\
        done
@@ -26,6 +27,7 @@ uninstall-local:
        for f in $(SAMPLES) ; do \
                rm -f $(DESTDIR)$(docdir)/samples/$$f ; \
        done
+       rm -f $(DESTDIR)$(docdir)/samples/gpg.rc
        -rm -rf $(DESTDIR)$(docdir)/samples/iconv
        -rmdir $(DESTDIR)$(docdir)/samples
        -rmdir $(DESTDIR)$(docdir)
diff --git a/contrib/gpg.rc b/contrib/gpg.rc.in
rename from contrib/gpg.rc
rename to contrib/gpg.rc.in
--- a/contrib/gpg.rc.in
+++ b/contrib/gpg.rc.in
@@ -31,44 +31,44 @@
 # breaking PGP/MIME.
 
 # decode application/pgp
-set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose 
--quiet --batch --output - %f"
+set pgp_decode_command="@GPG@ --status-fd=2 %?p?--passphrase-fd 0? 
--no-verbose --quiet --batch --output - %f"
 
 # verify a pgp/mime signature
-set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch 
--output - --verify %s %f"
+set pgp_verify_command="@GPG@ --status-fd=2 --no-verbose --quiet --batch 
--output - --verify %s %f"
 
 # decrypt a pgp/mime attachment
-set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose 
--quiet --batch --output - %f"
+set pgp_decrypt_command="@GPG@ --status-fd=2 %?p?--passphrase-fd 0? 
--no-verbose --quiet --batch --output - %f"
 
 # create a pgp/mime signed attachment
 # set pgp_sign_command="gpg-2comp --comment '' --no-verbose --batch --output - 
%?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
-set pgp_sign_command="gpg --no-verbose --batch --quiet --output - 
%?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
+set pgp_sign_command="@GPG@ --no-verbose --batch --quiet --output - 
%?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"
 
 # create a application/pgp signed (old-style) message
 # set pgp_clearsign_command="gpg-2comp --comment '' --no-verbose --batch 
--output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
-set pgp_clearsign_command="gpg --no-verbose --batch --quiet --output - 
%?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
+set pgp_clearsign_command="@GPG@ --no-verbose --batch --quiet --output - 
%?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"
 
 # create a pgp/mime encrypted attachment
 # set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - 
--encrypt --textmode --armor --always-trust -- -r %r -- %f"
-set pgp_encrypt_only_command="pgpewrap gpg --batch --quiet --no-verbose 
--output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
+set pgp_encrypt_only_command="pgpewrap @GPG@ --batch --quiet --no-verbose 
--output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
 
 # create a pgp/mime encrypted and signed attachment
 # set pgp_encrypt_sign_command="pgpewrap gpg-2comp %?p?--passphrase-fd 0? -v 
--batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r 
-- %f"
-set pgp_encrypt_sign_command="pgpewrap gpg %?p?--passphrase-fd 0? --batch 
--quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor 
--always-trust -- -r %r -- %f"
+set pgp_encrypt_sign_command="pgpewrap @GPG@ %?p?--passphrase-fd 0? --batch 
--quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor 
--always-trust -- -r %r -- %f"
 
 # import a key into the public key ring
-set pgp_import_command="gpg --no-verbose --import %f"
+set pgp_import_command="@GPG@ --no-verbose --import %f"
 
 # export a key from the public key ring
-set pgp_export_command="gpg --no-verbose --export --armor %r"
+set pgp_export_command="@GPG@ --no-verbose --export --armor %r"
 
 # verify a key
-set pgp_verify_key_command="gpg --verbose --batch --fingerprint --check-sigs 
%r"
+set pgp_verify_key_command="@GPG@ --verbose --batch --fingerprint --check-sigs 
%r"
 
 # read in the public key ring
-set pgp_list_pubring_command="gpg --no-verbose --batch --quiet --with-colons 
--list-keys %r" 
+set pgp_list_pubring_command="@GPG@ --no-verbose --batch --quiet --with-colons 
--list-keys %r" 
 
 # read in the secret key ring
-set pgp_list_secring_command="gpg --no-verbose --batch --quiet --with-colons 
--list-secret-keys %r" 
+set pgp_list_secring_command="@GPG@ --no-verbose --batch --quiet --with-colons 
--list-secret-keys %r" 
 
 # fetch keys
 # set pgp_getkeys_command="pkspxycwrap %r"

Attachment: pgpZBhfvyHY9W.pgp
Description: PGP signature