mblaze/contrib/mgpg

21 lines
368 B
Plaintext
Raw Normal View History

2017-05-26 13:57:56 +00:00
#!/bin/sh -e
tmp=$(mktemp -t mgpg.XXXXXX)
2017-05-26 13:57:56 +00:00
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
2019-01-10 15:42:05 +00:00
mshow -O "$tmp" "$n" | gpg2 -d 2>&1 || exit 0
2017-05-26 13:57:56 +00:00
exit 64
fi
exit 63