summaryrefslogtreecommitdiff
path: root/mailman/mklist.pl
diff options
context:
space:
mode:
authorroot <root@homebase.dk>2010-10-30 15:50:03 +0200
committerroot <root@homebase.dk>2010-10-30 15:50:03 +0200
commitea033afebef6d6c02b36a46ac8f6c91a39452118 (patch)
tree5bdfa6e86420b372735133a912672eb39626ce38 /mailman/mklist.pl
parent1f6f808899bc11baaa4a25d2d921addb8e97559d (diff)
Add Mailman skeleton-based mklist routines.
Diffstat (limited to 'mailman/mklist.pl')
-rwxr-xr-xmailman/mklist.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/mailman/mklist.pl b/mailman/mklist.pl
new file mode 100755
index 0000000..a3bdfcd
--- /dev/null
+++ b/mailman/mklist.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+# TODO: derive listname from subjectprefix (which allows space and [])
+
+use warnings;
+
+our ($listname, $listdesc, $listhost, $senders, $senderfilter, $listowner);
+
+my $config_file_addon_org="/etc/local-ORG/mailman/mklist.conf.addon";
+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'} or die "SENDERFILTER missing";
+$listowner ||= $ENV{'LISTOWNER'} or die "LISTOWNER missing";
+
+while (<>) {
+ # Replace keywords - execept in comments
+ s/^([^#]*)LISTNAME/$1$listname/g;
+ s/^([^#]*)LISTDESC/$1$listdesc/g;
+ s/^([^#]*)LISTHOST/$1$listhost/g;
+ s/^([^#]*)SENDERS/$1$senders/g;
+ s/^([^#]*)SENDERFILTER/$1$senderfilter/g;
+ s/^([^#]*)LISTOWNER/$1$listowner/g;
+
+ print;
+}
+
+1;