blob: 8bc632c43fc32d08cf57c94050e3f109ab6c74bd (
plain)
- #!/bin/sh
- set -e
- basedir="/etc/local-COMMON/amavis"
- destfile="amavisd.conf.addon"
- >"$basedir/$destfile.new" cat <<EOF
- #!/bin/perl
- ### WARNING: This file is generated automatically.
- ### Please edit $destfile.in and run mkaddon.sh
- EOF
- grep -v '^#!/bin/perl' "$basedir/$destfile.in" >> "$basedir/$destfile.new"
- echo "\$bypass_spam_checks_acl = qw( spamalert@ spam.police@ );" >> "$basedir/$destfile.new"
- #####################################################
- # Something's wrong - avoid cross-domain sharing of notifications for now. :-(
- cp -af "$basedir/$destfile" "$basedir/$destfile.old"
- mv "$basedir/$destfile.new" "$basedir/$destfile"
- exit 0
- #####################################################
- domainfiles="`find "$basedir" -name 'local_domains_*' -type f | sort -u`"
- maildomains=""
- for domainfile in $domainfiles; do
- maildomain="`basename $domainfile | sed 's/local_domains_//'`"
- maildomain_="`echo $maildomain | sed 's/\./_/g'`"
- maildomains="$maildomains $maildomain"
- domains="`cat "$domainfile" | grep -v '^#' | sed 's/#.*//' | sort -u`"
- eval "domains_$maildomain_=\"$domains\""
- done
- echo >> "$basedir/$destfile.new"
- echo "\$bypass_spam_checks_acl = qw(" >> "$basedir/$destfile.new"
- for maildomain in $maildomains; do
- echo " spamalert@$maildomain" >> "$basedir/$destfile.new"
- echo " spam.police@$maildomain" >> "$basedir/$destfile.new"
- done
- echo " spam-quarantine@" >> "$basedir/$destfile.new"
- echo ");" >> "$basedir/$destfile.new"
- for thing in virus spam; do
- echo >> "$basedir/$destfile.new"
- echo "\$${thing}_admin = {" >> "$basedir/$destfile.new"
- for maildomain in $maildomains; do
- maildomain_="`echo $maildomain | sed 's/\./_/g'`"
- eval "domains=\"\$domains_$maildomain_\""
- for domain in $domains; do
- echo " '.$domain' => '${thing}alert@$maildomain'," >> "$basedir/$destfile.new"
- done
- done
- echo " '.' => \"${thing}alert\\@\$mydomain\"," >> "$basedir/$destfile.new"
- echo "};" >> "$basedir/$destfile.new"
- done
- cp -af "$basedir/$destfile" "$basedir/$destfile.old"
- mv "$basedir/$destfile.new" "$basedir/$destfile"
|