summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-06-28 10:54:07 +0200
committerErich Eckner <git@eckner.net>2019-06-28 10:54:07 +0200
commitc0284b94095d0809552fded5afab440bd3a2f044 (patch)
tree2933b14bed36fb61934411b5ac1e900fb6a790db
parent1da0b7cde63cee4d736b5429ee188f8c820d1b12 (diff)
downloadsendmailadvanced-c0284b94095d0809552fded5afab440bd3a2f044.tar.xz
gpg_recipient -> gpg_recipients: allow for multiple default recipients
-rw-r--r--man.commons.in4
-rwxr-xr-xsendmailadvanced.conf4
-rwxr-xr-xsendmailadvanced.in7
3 files changed, 10 insertions, 5 deletions
diff --git a/man.commons.in b/man.commons.in
index 275ddb7..0eaf962 100644
--- a/man.commons.in
+++ b/man.commons.in
@@ -1,8 +1,8 @@
[CONFIGURATION]
The configfile \fB#ETCDIR#/sendmailadvanced.conf\fP is a bash script, which defines the following variables and routines:
.TP
-.B "gpg_recipient"
-default recipient to encrypt to
+.B "gpg_recipients"
+list of default recipients to encrypt to
.TP
.B "hashcash_bits"
stamp value
diff --git a/sendmailadvanced.conf b/sendmailadvanced.conf
index cf7932d..477502e 100755
--- a/sendmailadvanced.conf
+++ b/sendmailadvanced.conf
@@ -3,7 +3,9 @@
# configuration for sendmailadvanced
# default recipient to encrypt to
-gpg_recipient="me@example.com"
+gpg_recipients=(
+ "me@example.com"
+)
# stamp value
hashcash_bits=22
diff --git a/sendmailadvanced.in b/sendmailadvanced.in
index 3c12fe8..b7aa435 100755
--- a/sendmailadvanced.in
+++ b/sendmailadvanced.in
@@ -63,7 +63,7 @@ gpgAdressaten() {
then
echo -n "-r ${adressat} "
else
- echo -n "-r ${gpg_recipient} "
+ printf -- '-r %s ' "${gpg_recipients[@]}"
fi
done
}
@@ -102,7 +102,10 @@ else
done
fi
-gpg --list-keys "${gpg_recipient}" &> /dev/null || encrypt=false
+[ -z "${gpg_recipients[*]}" ] && encrypt=false
+for gpg_recipient in "${gpg_recipients[@]}"; do
+ gpg --list-keys "${gpg_recipient}" &> /dev/null || encrypt=false
+done
which hashcash &> /dev/null || stamp=false
eval set -- "$(getopt -o eh:i:st --long encrypt,no-encrypt,hook:,help,inline:,no-inline,stamp,no-stamp,version -n "$(basename "$0")" -- "$@" || echo verwendung)"