summaryrefslogtreecommitdiff
path: root/localmailrecipientsdump
diff options
context:
space:
mode:
authorroot <root@borneuni.dk>2009-09-14 05:57:19 +0200
committerroot <root@borneuni.dk>2009-09-14 05:57:19 +0200
commit3be9849d8548d1af073a6d3db21cd15e2172604d (patch)
tree26848a26d2a7a7b79aa9871cd1a634fb5baeb798 /localmailrecipientsdump
parent0dd15446c8271ce6d304ee4e524f2e4165e3957e (diff)
Extend localmailrecipientsdump to (crudely) handle sympa domains.
Diffstat (limited to 'localmailrecipientsdump')
-rwxr-xr-xlocalmailrecipientsdump23
1 files changed, 20 insertions, 3 deletions
diff --git a/localmailrecipientsdump b/localmailrecipientsdump
index 6662d55..d96038f 100755
--- a/localmailrecipientsdump
+++ b/localmailrecipientsdump
@@ -29,7 +29,12 @@ aliasmaps() {
virtualmaps() {
set -e
- perl -ne 's/^virtual_maps\s*=\s*// and print' < /etc/postfix/main.cf | tr ',' ' '
+ newmaps="$(postconf -h virtual_alias_maps)"
+ if [ '$virtual_maps' = "$newmaps" ]; then
+ perl -ne 's/^virtual_maps\s*=\s*// and print' < /etc/postfix/main.cf | tr ',' ' '
+ else
+ echo "$newmaps" | tr ',' ' '
+ fi
}
accounts() {
@@ -49,11 +54,23 @@ mkrecipientsmap() {
done
done
for map in $(virtualmaps); do
- postmap -s $map | perl -ne 's/^([a-z]\S*\@\S+)\s.*/$1 OK/ and print'
+ case $map in
+ regexp:/etc/mail/sympa_virtual_regexp_*)
+ # FIXME: replace catch-all with actual accounts
+ echo "$map" | perl -ne 's,regexp:/etc/mail/sympa_virtual_regexp_(\S+).*,\@$1 OK, and print'
+ ;;
+ hash:*)
+ postmap -s $map | perl -ne 's/^([a-z]\S*\@\S+)\s.*/$1 OK/ and print'
+ ;;
+ *)
+ echo >&2 "Unsupported map type: $map"
+ exit 1
+ ;;
+ esac
done
}
redpill="$(firstitem "/etc/local-ORG/redpill")"
realm="$(firstitem "/etc/local-ORG/realm")"
-mkrecipientsmap | sort -t@ -k2 -k1 > "/etc/local-$redpill/$realm/mailrecipients"
+mkrecipientsmap | LC_ALL=C sort -t@ -k2 -k1 > "/etc/local-$redpill/$realm/mailrecipients"