blob: 7a5a37067472578930c18b45b2343fba33581d47 (
plain)
- #!/bin/sh
- #
- # /etc/local-COMMON/amavis/mklists.sh
- # Copyright 2007 Jonas Smedegaard <dr@jones.dk>
- #
- # $Id: mklists.sh,v 1.1 2007-09-25 12:22:10 jonas Exp $
- #
- # Resolve own mail domains and MX backup domains
- set -e
- # Let's standardize sort
- export LC_ALL=C
- realmsdir='/etc/local-REDPILL'
- domainconfdir='/etc/local-ORG/amavis'
- if ! [ -d "$realmsdir" ]; then
- echo "WARNING: Realms directory \"$realmsdir\" does not exist."
- fi
- if ! [ -d "$domainconfdir" ]; then
- echo "WARNING: Domain config directory \"$domainconfdir\" does not exist."
- fi
- catfilefromownrealm() {
- file="$1"
- [ -d "$realmsdir" ] || exit 0
- thisrealm="$(cat /etc/local-ORG/realm || dnsdomainname | tr '[a-z]' '[A-Z]')"
- cat "$realmsdir/$thisrealm/$file"
- }
- catallfilesfromotherrealms() {
- file="$1"
- [ -d "$realmsdir" ] || exit 0
- [ -f "$realmsdir/realms" ] || exit 0
- realms="$(cat "$realmsdir/realms" | sed 's/#.*//')"
- thisrealm="$(cat /etc/local-ORG/realm || dnsdomainname | tr '[a-z]' '[A-Z]')"
- for realm in $realms; do
- if [ "$thisrealm" != "$realm" ]; then
- cat "$realmsdir/$realm/$file"
- fi
- done
- }
- catfilefromownrealm maildomains | sort > "$domainconfdir/local_domains"
- catallfilesfromotherrealms maildomains | sort > "$domainconfdir/nonlocal_domains"
|