From: JNRowe <JNRowe@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] RFC: Allow gpg and gpg2 for gnupg interaction
Date: Mon, 16 Nov 2020 19:31:48 +0100 [thread overview]
Message-ID: <20201116183148.7wxOe0RCOUor6IplZna-RC_1xG3g4LKMPuCJlURWA2o@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-193@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]
There is an updated pull request by JNRowe against master on the mblaze repository
https://github.com/JNRowe/mblaze master
https://github.com/leahneukirchen/mblaze/pull/193
RFC: Allow gpg and gpg2 for gnupg interaction
The attached commit enables using `gpg` *or* `gpg2` for `gnupg` interaction. The main reason being that Debian installs `gnupg` v2 as `gpg`, and provides an [additional package of just symlinks for gpg2](https://packages.debian.org/buster/gnupg2). I’ll additionally note that, for example, `pass` supports using either so I *believe* compatibility isn’t an issue.
Thoughts?
Thanks,
James
---
Refs 08a46e684855ad8c51c154f843fb1d8527045d33, d9aaac690357d55629b8bbdc885235f68e508783 and 87e5a1b2c308dfa9db85cb3cdd9aa105a5046aed. This purposely doesn’t touch the `GNUmakefile` despite da457c51ee9b0c02c886a7dc641135d3bfa82e63, as you know how your release system works much better than I do ;)
A patch file from https://github.com/leahneukirchen/mblaze/pull/193.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-193.patch --]
[-- Type: text/x-diff, Size: 3334 bytes --]
From 18d952ea31f1ad544f25bd0c3fb48642f8ba5591 Mon Sep 17 00:00:00 2001
From: James Rowe <jnrowe@gmail.com>
Date: Sun, 8 Nov 2020 20:26:19 +0000
Subject: [PATCH] Allow gpg and gpg2 executables for gnupg interaction
---
contrib/mencrypt | 8 +++++++-
contrib/mgpg | 8 +++++++-
contrib/msign | 8 +++++++-
contrib/mverify | 10 ++++++++--
4 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/contrib/mencrypt b/contrib/mencrypt
index 10077d6..71d5bac 100755
--- a/contrib/mencrypt
+++ b/contrib/mencrypt
@@ -10,12 +10,18 @@ FLAGS=$(maddr -a -h from:to:cc:bcc: "$1" |sort -u |sed 's/^/--recipient=/')
FROM=$(maddr -a -h from "$1" | sed 1q)
[ "$FROM" ] && key="--default-key=$FROM"
+if command -v gpg2 >/dev/null; then
+ GPG=gpg2
+else
+ GPG=gpg
+fi
+
TMPD=$(mktemp -d -t mencrypt.XXXXXX)
trap "rm -rf '$TMPD'" INT TERM EXIT
awk '/^$/,0' "$1" |
mmime |
- gpg2 "$key" --armor --encrypt --sign $FLAGS -o "$TMPD/msg.asc" ||
+ $GPG "$key" --armor --encrypt --sign $FLAGS -o "$TMPD/msg.asc" ||
exit $?
printf 'Version: 1\n' >"$TMPD/version"
diff --git a/contrib/mgpg b/contrib/mgpg
index 4f0cfa4..4a46701 100755
--- a/contrib/mgpg
+++ b/contrib/mgpg
@@ -1,5 +1,11 @@
#!/bin/sh -e
+if command -v gpg2 >/dev/null; then
+ GPG=gpg2
+else
+ GPG=gpg
+fi
+
tmp=$(mktemp -t mgpg.XXXXXX)
trap "rm -f '$tmp'" INT TERM EXIT
@@ -14,7 +20,7 @@ n=$(mshow -t "$tmp" | awk -F: '
/: application\/octet-stream/ {if (supported) print $1}')
if [ "$n" ]; then
- mshow -O "$tmp" "$n" | gpg2 -d 2>&1 || exit 0
+ mshow -O "$tmp" "$n" | $GPG -d 2>&1 || exit 0
exit 64
fi
exit 63
diff --git a/contrib/msign b/contrib/msign
index 7f23ab4..c21e2fc 100755
--- a/contrib/msign
+++ b/contrib/msign
@@ -3,6 +3,12 @@
[ -f "$1" ] || exit 1
+if command -v gpg2 >/dev/null; then
+ GPG=gpg2
+else
+ GPG=gpg
+fi
+
IFS='
'
@@ -13,7 +19,7 @@ FROM=$(maddr -a -h from "$1" | sed 1q)
[ "$FROM" ] && key="--default-key=$FROM"
awk '/^$/,0' "$1" | mmime | sed 's/$/\r/' >"$TMPD"/content
-gpg2 $key --armor --detach-sign -o "$TMPD"/signature.asc "$TMPD"/content ||
+$GPG $key --armor --detach-sign -o "$TMPD"/signature.asc "$TMPD"/content ||
exit $?
{
diff --git a/contrib/mverify b/contrib/mverify
index 24db88d..1624d49 100755
--- a/contrib/mverify
+++ b/contrib/mverify
@@ -3,6 +3,12 @@
# Needs gpg2 (for OpenPGP) and openssl (for SMIME).
+if command -v gpg2 >/dev/null; then
+ GPG=gpg2
+else
+ GPG=gpg
+fi
+
[ "$#" -eq 0 ] && set -- .
mshow -t "$1" | DOS2UNIX='/\r$/!s/$/\r/' awk -v "msg=$1" '
@@ -14,7 +20,7 @@ signed && content && !signature && indent == si+2 { signature = 0+$1; type = $2
function q(a) { gsub("\\47", "\47\\\47\47", a); return "\47"a"\47" }
END {
if (type == "" && plain) { // guess plain text armored signature
- exit(system("mshow -r " q(msg) " | gpg2 --verify"));
+ exit(system("mshow -r " q(msg) " | '$GPG' --verify"));
} else if (type == "") {
print("No signature found.")
exit(100)
@@ -22,7 +28,7 @@ END {
exit(system("mshow -r -O " q(msg) " " q(content) \
" | sed $DOS2UNIX | " \
" { mshow -O " q(msg) " " q(signature) \
- " | gpg2 --verify - /dev/fd/3; } 3<&0"))
+ " | '$GPG' --verify - /dev/fd/3; } 3<&0"))
} else if (type == "application/pkcs7-signature") {
exit(system("mshow -r -O " q(msg) " " q(signed) \
" | openssl smime -verify"))
next prev parent reply other threads:[~2020-11-16 18:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 20:31 [PR PATCH] RFC: Allow `gpg` and `gpg2` for `gnupg` interaction JNRowe
2020-11-08 21:59 ` [PR PATCH] [Updated] RFC: Allow gpg and gpg2 for gnupg interaction JNRowe
2020-11-16 18:31 ` JNRowe [this message]
2020-11-24 13:15 ` leahneukirchen
2020-11-24 13:16 ` [PR PATCH] [Closed]: " leahneukirchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201116183148.7wxOe0RCOUor6IplZna-RC_1xG3g4LKMPuCJlURWA2o@z \
--to=jnrowe@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).