blob: 8c7e72c12ae7b8a1e9996db113a4330b2ed442d8 (
plain)
- #!/usr/bin/perl
- # TODO: derive listname from subjectprefix (which allows space and [])
- use warnings;
- our ($listname, $listdesc, $listhost, $senders, $senderfilter, $senderfilters, $listowner, $listowners);
- # 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";
- $senderfilter ||= $ENV{'SENDERFILTER'};
- $senderfilter ||= '';
- $senderfilters ||= $ENV{'SENDERFILTERS'};
- $senderfilters ||= "'" . $senderfilter ."'" or warn "Ignoring missing SENDERFILTER(S)";
- $listowner ||= $ENV{'LISTOWNER'};
- $listowner ||= '';
- $listowners ||= $ENV{'LISTOWNERS'};
- $listowners ||= "'" . $listowner . "'" 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;
|