Add scripts from mblaze/contrib

Directly from tag v6.0, e0733f187b34b21fa8335b9914c29a28fa2e856d.
This commit is contained in:
Lucas 2020-03-11 23:32:09 +00:00
parent 69e00b6f58
commit eb605487e5
5 changed files with 111 additions and 2 deletions

25
mblaze/contrib/msign Executable file
View file

@ -0,0 +1,25 @@
#!/bin/sh
# msign PLAINMSG - generate a PGP/MIME signed message
[ -f "$1" ] || exit 1
IFS='
'
TMPD=$(mktemp -d -t msign.XXXXXX)
trap "rm -rf '$TMPD'" INT TERM EXIT
FROM=$(maddr -a -h from "$1" | sed 1q)
[ "$FROM" ] && key="--default-key=$FROM"
awk '/^$/,0' "$1" | mmime | sed 's/$/ /' >"$TMPD"/content
gpg2 $key --armor --detach-sign -o "$TMPD"/signature.asc "$TMPD"/content ||
exit $?
{
sed '/^$/q' "$1"
printf '#mblaze/raw %s/content\n' "$TMPD"
printf '#application/pgp-signature %s/signature.asc\n' "$TMPD"
} |
mmime -t 'multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"'