mirror of
https://github.com/leahneukirchen/mblaze
synced 2024-11-11 13:10:32 +00:00
bc021c53b6
Closes: #193 [via git-merge-pr]
27 lines
432 B
Bash
Executable File
27 lines
432 B
Bash
Executable File
#!/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
|
|
|
|
{
|
|
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 0
|
|
exit 64
|
|
fi
|
|
exit 63
|