From 81be0aeab019dd3c8a72c199b402aaf58e2aa5fa Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 3 Feb 2014 23:16:31 +0100 Subject: procmailrc: Reduce number of formail(1) calls Reduce the number of formail(1) calls, and make things a bit more readable. diff --git a/etc/procmailrc b/etc/procmailrc index 5ffeba8..77a02e2 100644 --- a/etc/procmailrc +++ b/etc/procmailrc @@ -3,42 +3,30 @@ PATH = /usr/bin:/bin LOGFILE = $HOME/log/procmail.log GITHUB_FILTER = $HOME/libexec/filter-github-emails DEFAULT_RECIPIENT = admin@monitoring-plugins.org -FROM = `formail -c -x 'From ' | cut -d ' ' -f 1` EXTENSION = $1 -:0 fhw -| formail -A "X-Original-From: $FROM" - -# -# Handle emails sent to . -# :0 -* EXTENSION ?? ^^github^^ * ! ^X-Loop: plugins@monitoring-plugins\.org { - :0 fw - | $GITHUB_FILTER - - # - # Forward the email only if $GITHUB_FILTER rewrote the To: header. - # :0 fhw - * ^To:(.*[^-a-zA-Z0-9_.])?devel@monitoring-plugins\.org - | formail -A 'X-Loop: plugins@monitoring-plugins.org' + * ^From \/[^ ]+ + | formail -A 'X-Loop: plugins@monitoring-plugins.org' \ + -A "X-Original-From: $MATCH" - :0 a - ! devel@monitoring-plugins.org -} + # Handle emails sent to . + :0 + * EXTENSION ?? ^^github^^ + { + :0 fw + | $GITHUB_FILTER -# -# Handle emails that shouldn't be forwarded to the mailing list. -# -:0 -* ! ^X-Loop: plugins@monitoring-plugins\.org -{ - :0 fhw - | formail -A 'X-Loop: plugins@monitoring-plugins.org' + # Forward only if $GITHUB_FILTER rewrote the To: header. + :0 + * ^To:.*\/devel@monitoring-plugins\.org + ! $MATCH + } + # Handle emails that shouldn't be forwarded to the list. :0 ! $DEFAULT_RECIPIENT } -- cgit v0.10-9-g596f