blob: c7870510cc77080cfb2f12835391eccadd90e4fd (
plain)
- #!/usr/bin/perl
- # TODO: derive listname from subjectprefix (which allows space and [])
- use warnings;
- our ($listname, $listdesc, $listhost, $senders, $senderfilter, $listowner);
- # Load optional config
- my $config_file_addon_org = "/etc/local-ORG/mailman/mklist.conf";
- if ( -f $config_file_addon_org ) {
- do $config_file_addon_org
- or die "Error in config file $config_file_addon_org: $@";
- } else {
- warn "Ignoring non-existing file $config_file_addon_org";
- }
- $listname = $ENV{'LISTNAME'} or die "LISTNAME missing";
- $listdesc = $ENV{'LISTDESC'} or die "LISTDESC missing";
- $listhost = $ENV{'LISTHOST'} or die "LISTHOST missing";
- $senders = $ENV{'SENDERS'} or die "SENDERS missing";
- $senderfilters = $ENV{'SENDERFILTER'} || $ENV{'SENDERFILTERS'} || ''
- or warn "Ignoring missing SENDERFILTER(S)";
- $listowners = $ENV{'LISTOWNER'} || $ENV{'LISTOWNERS'}
- or die "LISTOWNER(S) missing";
- while (<>) {
- # Replace keywords - except in comments
- s/^([^#]*)LISTNAME/$1$listname/g;
- s/^([^#]*)LISTDESC/$1$listdesc/g;
- s/^([^#]*)LISTHOST/$1$listhost/g if ($listhost);
- s/^([^#]*)LISTHOST/#$1/g unless ($listhost);
- s/^([^#]*)SENDERS/$1$senders/g;
- s/^([^#]*)SENDERFILTERS/$1$senderfilters/g;
- s/^([^#]*)LISTOWNERS/$1$listowners/g;
- print;
- }
- 1;
|