env/mblaze/contrib/mgpg
Lucas eb605487e5 Add scripts from mblaze/contrib
Directly from tag v6.0, e0733f187b34b21fa8335b9914c29a28fa2e856d.
2020-03-11 23:33:13 +00:00

21 lines
368 B
Bash
Executable File

#!/bin/sh -e
tmp=$(mktemp -t mgpg.XXXXXX)
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" | gpg2 -d 2>&1 || exit 0
exit 64
fi
exit 63