blob: d0f254933a5d02a196a152b86133d1674ff5d50e (
plain)
- #!/usr/bin/perl
- # TODO: derive listname from subjectprefix (which allows space and [])
- use warnings;
- our ($listname, $listdesc, $listhost, $senders, $senderfilter, $senderfilters, $listowner, $listowners, $moderator, $moderators);
- # 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{'SENDERFILTERS'} || "'$senderfilter'" || "'$ENV{'SENDERFILTER'}'" || ''
- or warn "Ignoring missing SENDERFILTER(S)";
- $listowners ||= $ENV{'LISTOWNERS'} || "'$listowner'" || "'$ENV{'LISTOWNER'}'"
- or die "LISTOWNER(S) missing";
- $moderators ||= $ENV{'MODERATORS'} || "'$moderator'" || "'$ENV{'MODERATOR'}'";
- 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;
- s/^([^#]*)MODERATORS/$1$moderators/g;
- print;
- }
- 1;
|