summaryrefslogtreecommitdiff
path: root/sendmailadvanced.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-10-10 09:53:38 +0200
committerErich Eckner <git@eckner.net>2019-10-10 09:53:38 +0200
commitad12c709f026e480d9cd3cc6662c2d826d58f57a (patch)
treeb0d78449c5d8b2bc4ae8385fe607e9a60479964e /sendmailadvanced.in
parentaae2b4b2711e6343e3e2f52ed0a7e595ce4ffb1d (diff)
downloadsendmailadvanced-ad12c709f026e480d9cd3cc6662c2d826d58f57a.tar.xz
put hooks into /etc/sendmailadvances.hooks/
Diffstat (limited to 'sendmailadvanced.in')
-rwxr-xr-xsendmailadvanced.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/sendmailadvanced.in b/sendmailadvanced.in
index 5904f46..5e5a58e 100755
--- a/sendmailadvanced.in
+++ b/sendmailadvanced.in
@@ -4,7 +4,7 @@ verwendung() {
>&2 echo 'sendmailadvanced encrypts emails and generates stamps either in situ or in a pipe. For that it uses hashcash and gnupg.'
>&2 echo ''
>&2 echo 'Usage: sendmailadvanced [OPTIONS]'
- >&2 echo ' -h,--hook=hook activate hook'
+ >&2 echo ' -h,--hook=hook activate hook; "ALL" chooses all available hooks'
>&2 echo ' -i,--inline=file enhance email file in situ.'
>&2 echo ' "--inline -" has the same effect as "-t".'
>&2 echo ' Conflicts with -t|--no-inline.'
@@ -108,7 +108,15 @@ while true; do
case "$1" in
-h|--hook)
shift
- hooks[${#hooks[@]}]="$1"
+ if [ "x$1" = 'xALL' ]; then
+ for hook in $(find '#ETCDIR#/sendmailadvanced.hooks' -type f); do
+ if [ -x "#ETCDIR#/sendmailadvanced.hooks/${hook}" ]; then
+ hooks[${#hooks[@]}]="${hook}"
+ fi
+ done
+ else
+ hooks[${#hooks[@]}]="$1"
+ fi
;;
--help)
verwendung 0
@@ -219,11 +227,11 @@ fi
body=$(
(
for hookParam in "${hooks[@]}"; do
- body_header_hook "${hookParam}"
+ "#ETCDIR#/sendmailadvanced.hooks/${hookParam}" head
done
cat
for hookParam in "${hooks[@]}"; do
- body_footer_hook "${hookParam}"
+ "#ETCDIR#/sendmailadvanced.hooks/${hookParam}" foot
done
) | \
if ${encrypt}; then