From ad12c709f026e480d9cd3cc6662c2d826d58f57a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 10 Oct 2019 09:53:38 +0200 Subject: put hooks into /etc/sendmailadvances.hooks/ --- sendmailadvanced.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'sendmailadvanced.in') 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 -- cgit v1.2.3-54-g00ecf