* [PR PATCH] RFC: Allow `gpg` and `gpg2` for `gnupg` interaction
@ 2020-11-08 20:31 JNRowe
2020-11-08 21:59 ` [PR PATCH] [Updated] RFC: Allow gpg and gpg2 for gnupg interaction JNRowe
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: JNRowe @ 2020-11-08 20:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
There is a new 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: 3330 bytes --]
From c61ebe4e06c2da9af83a0a1f47ee77107d6977bc 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..cf65d09 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"))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Updated] RFC: Allow gpg and gpg2 for gnupg interaction
2020-11-08 20:31 [PR PATCH] RFC: Allow `gpg` and `gpg2` for `gnupg` interaction JNRowe
@ 2020-11-08 21:59 ` JNRowe
2020-11-16 18:31 ` JNRowe
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: JNRowe @ 2020-11-08 21:59 UTC (permalink / raw)
To: ml
[-- 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: 3332 bytes --]
From 53aa7e2a2a46c39a83646521d90e78b845e01426 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..adc08d0 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"))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Updated] RFC: Allow gpg and gpg2 for gnupg interaction
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
2020-11-24 13:15 ` leahneukirchen
2020-11-24 13:16 ` [PR PATCH] [Closed]: " leahneukirchen
3 siblings, 0 replies; 5+ messages in thread
From: JNRowe @ 2020-11-16 18:31 UTC (permalink / raw)
To: ml
[-- 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"))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFC: Allow gpg and gpg2 for gnupg interaction
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
@ 2020-11-24 13:15 ` leahneukirchen
2020-11-24 13:16 ` [PR PATCH] [Closed]: " leahneukirchen
3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2020-11-24 13:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/193#issuecomment-732966093
Comment:
Looks good to me. Sorry for the late review, I somehow missed this.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Closed]: RFC: Allow gpg and gpg2 for gnupg interaction
2020-11-08 20:31 [PR PATCH] RFC: Allow `gpg` and `gpg2` for `gnupg` interaction JNRowe
` (2 preceding siblings ...)
2020-11-24 13:15 ` leahneukirchen
@ 2020-11-24 13:16 ` leahneukirchen
3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2020-11-24 13:16 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 882 bytes --]
There's a closed pull request on the mblaze repository
RFC: Allow gpg and gpg2 for gnupg interaction
https://github.com/leahneukirchen/mblaze/pull/193
Description:
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 ;)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-24 13:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-11-24 13:15 ` leahneukirchen
2020-11-24 13:16 ` [PR PATCH] [Closed]: " leahneukirchen
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).