/evolution-gnupg-auto-key-locate-interoperability-patch.sh Secret
Created Oct 26, 2019
This script is meant to be an adapter for GNOME Evolution to GnuPG. When encrypting e-mails with Evolution 3.22.6, the recipient is specified by Evolution in the form "<user@examle.com>". For the usage of the GnuPG 2.2.12 option `auto-key-locate keyserver` the user-id must be in the form "user@example.com". This script simply removes the angle b…
#!/bin/bash | |
# About this script | |
# ================= | |
# | |
# This script is meant to be an adapter for GNOME Evolution to GnuPG. | |
# When encrypting e-mails with Evolution 3.22.6, the recipient is specified by | |
# Evolution in the form "<user@examle.com>". For the usage of the GnuPG 2.2.12 | |
# option `auto-key-locate keyserver` the user-id must be in the form | |
# "user@example.com" [1]. This script simply removes the angle brackets from | |
# the recipient specification and forwards all arguments to `gpg`. | |
# [1]: https://dev.gnupg.org/T4726 | |
# | |
# How to use | |
# ========== | |
# | |
# Direct Evolution to use this script instead of gpg directly. Therefor use | |
# `dconf-editor` to set `org.gnome.evolution-data-server.camel-gpg-binary` to | |
# the absolute path of this script. | |
# Set general error checking measures for scripting | |
set -o errexit # Used to exit upon error, avoiding cascading errors | |
# Test the number of arguments | |
if [ $# -lt 1 ] | |
then | |
echo "Invalid number of arguments!" | |
exit 1 | |
fi | |
# Get temporary file | |
temporaryFile=`mktemp` | |
trap "rm $temporaryFile" EXIT # remove file when finished | |
# Find addresses in the form "\<local@domain\>" [2] and remove angle brackets. | |
# [2]: https://tools.ietf.org/html/rfc5321#section-2.3.11 | |
printf " %q" "$@" | sed --regexp-extended 's| -r \\<(\S+@\S+)\\>| -r \1|' > $temporaryFile | |
# Run GnuPG with modified arguments | |
xargs --arg-file=$temporaryFile gpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.