#!/usr/bin/perl -w package esmith; use strict; use Errno; use esmith::ConfigDB; use esmith::AccountsDB; use esmith::util; my $c = esmith::ConfigDB->open_ro || die "Couldn't open config db\n"; my $a = esmith::AccountsDB->open_ro || die "Couldn't open accounts db\n"; my $event = $ARGV [0] || die "Event name arg missing\n";; my @lists; if ($ARGV[1]){ @lists = $a->get($ARGV[1]); } @lists = $a->get_all_by_prop(type=>'minilist') if (scalar @lists lt 1); foreach my $list (@lists){ my $name = $list->key; unless ($list->prop('type') eq 'minilist'){ warn "Account $name is not a mailinglist account.\n"; next; } my $members = $list->prop('Members') || ''; esmith::util::processTemplate( { CONFREF => { Members => $members, }, TEMPLATE_PATH => "/var/qmail/alias/.qmail-group", OUTPUT_FILENAME => "/var/qmail/alias/.qmail-$name", } ); unless (-f "/var/qmail/alias/.qmail-$name-default"){ symlink "/var/qmail/alias/.qmail-$name", "/var/qmail/alias/.qmail-$name-default"; } } exit (0);