From 3a9f5a0505f297e0e9e34dde019a2ec76edcfca7 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 4 Nov 2020 19:36:28 +0100 Subject: tidy list config mangling script --- mailman/mklist.pl | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/mailman/mklist.pl b/mailman/mklist.pl index 8c7e72c..1364b0b 100755 --- a/mailman/mklist.pl +++ b/mailman/mklist.pl @@ -4,28 +4,25 @@ use warnings; -our ($listname, $listdesc, $listhost, $senders, $senderfilter, $senderfilters, $listowner, $listowners); +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: $@"; + 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"; +$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 -- cgit v1.2.3