about summary refs log tree commit diff
path: root/contrib/mgpg
diff options
context:
space:
mode:
authorJames Rowe <jnrowe@gmail.com>2020-11-08 20:26:19 +0000
committerLeah Neukirchen <leah@vuxu.org>2020-11-24 14:15:29 +0100
commitbc021c53b6d49032efab050a8f1f6b44804916ac (patch)
tree36083dce74a32f8001e1d390920e715732ffae98 /contrib/mgpg
parent6a8543e3215f73cffe08230fe64b45a86fc15681 (diff)
downloadmblaze-bc021c53b6d49032efab050a8f1f6b44804916ac.tar.gz
mblaze-bc021c53b6d49032efab050a8f1f6b44804916ac.tar.xz
mblaze-bc021c53b6d49032efab050a8f1f6b44804916ac.zip
Allow gpg and gpg2 executables for gnupg interaction
Closes: #193 [via git-merge-pr]
Diffstat (limited to 'contrib/mgpg')
-rwxr-xr-xcontrib/mgpg8
1 files changed, 7 insertions, 1 deletions
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