Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhebbeker/36b3da99ea1a520ffd9a6ed9b3db7880 to your computer and use it in GitHub Desktop.
Save dhebbeker/36b3da99ea1a520ffd9a6ed9b3db7880 to your computer and use it in GitHub Desktop.
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
@dhebbeker
Copy link
Author

⛔ This script is obsolete since GnuPG 2.2.19 (see fix)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment