diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-02-03 23:16:31 +0100 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-02-03 23:16:31 +0100 |
| commit | 81be0aeab019dd3c8a72c199b402aaf58e2aa5fa (patch) | |
| tree | 1e90a40e224c7e77e5ce7094ce7c60d71024e23b | |
| parent | a19675bb16808f4d17d910e0acf18c1fd5e1f58d (diff) | |
| download | site-81be0aeab019dd3c8a72c199b402aaf58e2aa5fa.tar.gz | |
procmailrc: Reduce number of formail(1) calls
Reduce the number of formail(1) calls, and make things a bit more
readable.
| -rw-r--r-- | etc/procmailrc | 42 |
1 files changed, 15 insertions, 27 deletions
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 | |||
| 3 | LOGFILE = $HOME/log/procmail.log | 3 | LOGFILE = $HOME/log/procmail.log |
| 4 | GITHUB_FILTER = $HOME/libexec/filter-github-emails | 4 | GITHUB_FILTER = $HOME/libexec/filter-github-emails |
| 5 | DEFAULT_RECIPIENT = admin@monitoring-plugins.org | 5 | DEFAULT_RECIPIENT = admin@monitoring-plugins.org |
| 6 | FROM = `formail -c -x 'From ' | cut -d ' ' -f 1` | ||
| 7 | EXTENSION = $1 | 6 | EXTENSION = $1 |
| 8 | 7 | ||
| 9 | :0 fhw | ||
| 10 | | formail -A "X-Original-From: $FROM" | ||
| 11 | |||
| 12 | # | ||
| 13 | # Handle emails sent to <plugins+github@monitoring-plugins.org>. | ||
| 14 | # | ||
| 15 | :0 | 8 | :0 |
| 16 | * EXTENSION ?? ^^github^^ | ||
| 17 | * ! ^X-Loop: plugins@monitoring-plugins\.org | 9 | * ! ^X-Loop: plugins@monitoring-plugins\.org |
| 18 | { | 10 | { |
| 19 | :0 fw | ||
| 20 | | $GITHUB_FILTER | ||
| 21 | |||
| 22 | # | ||
| 23 | # Forward the email only if $GITHUB_FILTER rewrote the To: header. | ||
| 24 | # | ||
| 25 | :0 fhw | 11 | :0 fhw |
| 26 | * ^To:(.*[^-a-zA-Z0-9_.])?devel@monitoring-plugins\.org | 12 | * ^From \/[^ ]+ |
| 27 | | formail -A 'X-Loop: plugins@monitoring-plugins.org' | 13 | | formail -A 'X-Loop: plugins@monitoring-plugins.org' \ |
| 14 | -A "X-Original-From: $MATCH" | ||
| 28 | 15 | ||
| 29 | :0 a | 16 | # Handle emails sent to <plugins+github@monitoring-plugins.org>. |
| 30 | ! devel@monitoring-plugins.org | 17 | :0 |
| 31 | } | 18 | * EXTENSION ?? ^^github^^ |
| 19 | { | ||
| 20 | :0 fw | ||
| 21 | | $GITHUB_FILTER | ||
| 32 | 22 | ||
| 33 | # | 23 | # Forward only if $GITHUB_FILTER rewrote the To: header. |
| 34 | # Handle emails that shouldn't be forwarded to the mailing list. | 24 | :0 |
| 35 | # | 25 | * ^To:.*\/devel@monitoring-plugins\.org |
| 36 | :0 | 26 | ! $MATCH |
| 37 | * ! ^X-Loop: plugins@monitoring-plugins\.org | 27 | } |
| 38 | { | ||
| 39 | :0 fhw | ||
| 40 | | formail -A 'X-Loop: plugins@monitoring-plugins.org' | ||
| 41 | 28 | ||
| 29 | # Handle emails that shouldn't be forwarded to the list. | ||
| 42 | :0 | 30 | :0 |
| 43 | ! $DEFAULT_RECIPIENT | 31 | ! $DEFAULT_RECIPIENT |
| 44 | } | 32 | } |
