about summary refs log tree commit diff
path: root/contrib
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-05-26 15:57:56 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-05-26 15:57:56 +0200
commit687b3ddc0df89d48af5d20cb37fa2feb19a6c537 (patch)
tree6493ea447c5973942f8ecf3108da49f58c45eb8c /contrib
parentdf7cd7249c04cfe116aba64258b512c897fd9ef4 (diff)
downloadmblaze-687b3ddc0df89d48af5d20cb37fa2feb19a6c537.tar.gz
mblaze-687b3ddc0df89d48af5d20cb37fa2feb19a6c537.tar.xz
mblaze-687b3ddc0df89d48af5d20cb37fa2feb19a6c537.zip
add mgpg
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/mgpg20
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/mgpg b/contrib/mgpg
new file mode 100755
index 0000000..01c7c08
--- /dev/null
+++ b/contrib/mgpg
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+
+tmp=$(mktemp)
+trap "rm -f '$tmp'" INT TERM EXIT
+
+{
+	echo "Content-Type: $PIPE_CONTENTTYPE"
+	echo
+	cat
+} > "$tmp"
+
+n=$(mshow -t "$tmp" | awk -F: '
+	/: application\/pgp-encrypted/ {supported = 1}
+	/: application\/octet-stream/ {if (supported) print $1}')
+
+if [ "$n" ]; then
+	mshow -O "$tmp" "$n" | gpg -d 2>&1
+	exit 64
+fi
+exit 63