Changeset 328:73e179721396
- Timestamp:
- 08/22/11 16:55:25 (9 months ago)
- Author:
- Anselm Lingnau <anselm@…>
- Branch:
- default
- Message:
-
Various changes to pl-init.
pl-init will now add the list owner to the list as a subscriber with admin
privileges. This is mainly to make life easier for deployments of many lists
with Project Guinevere.
Also, the --config=... command line option was changed to read configuration
parameter assignments from a file whose name is given as the argument.
Individual paramter assignments may now be passed as additional command-line
arguments after the list owner address.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r303
|
r328
|
|
| 7 | 7 | =head1 SYNOPSIS |
| 8 | 8 | |
| 9 | | pl-init [-v?] [--clone=otherlist] [-config=CONFIG] ... |
| | 9 | pl-init [-v?] [--clone=otherlist] [--config=FILE] ... |
| 10 | 10 | [--[no]mailfilter] [--our-isp] [--verbose] |
| 11 | | list@domain owner-address |
| | 11 | list@domain owner-address key=value ... |
| 12 | 12 | |
| 13 | 13 | =head1 OVERVIEW |
| 14 | 14 | |
| 15 | | The B<pl-init> command creates a new Lancelot mailing list with no |
| 16 | | subscribers and a basic (if sensible) configuration. |
| | 15 | The B<pl-init> command creates a new Lancelot mailing list with |
| | 16 | a sensible (if basic) configuration. |
| 17 | 17 | |
| 18 | 18 | =head1 DESCRIPTION |
| … |
… |
|
| 26 | 26 | the content of a system-wide defaults file (if available), (3) the |
| 27 | 27 | content of the user-specific defaults file F<$HOME/.pl/defaults.conf> |
| 28 | | (if available), and (4) any configuration parameter assignments given |
| 29 | | on the command line, in that order. Later settings override earlier |
| 30 | | ones. Between (3) and (4), the B<list.address> parameter is set to |
| 31 | | I<list@domain>, the B<list.owneraddress> parameter is set to |
| 32 | | I<owner-address>, and the B<list.name> parameter is set to the |
| 33 | | local part of I<list@domain>, capitalised. |
| | 28 | (if available), (4) any files whose names are passed on the command line |
| | 29 | by means of the B<--config> option, and (5) any configuration parameter |
| | 30 | assignments given on the command line, in that order. Later settings |
| | 31 | override earlier ones. Between (3) and (4), the B<list.address> parameter |
| | 32 | is set to I<list@domain>, the B<list.owneraddress> parameter is set to |
| | 33 | I<owner-address>, the B<list.ownername> parameter is set to the list |
| | 34 | owner's name if one is passed as part of I<owner-address>, and the |
| | 35 | B<list.name> parameter is set to the local part of I<list@domain>, |
| | 36 | capitalised. |
| | 37 | |
| | 38 | Any command-line parameters passed after I<owner-address> will be |
| | 39 | considered configuration parameter assignments in the sense of (5) above. |
| | 40 | Note that these are pre-parsed by the shell, and USE QUOTES IF YOUR |
| | 41 | CONFIGURATION PARAMETER ASSIGNMENTS CONTAIN WHITESPACE. |
| 34 | 42 | |
| 35 | 43 | If a list configuration is "cloned" from that of another list, that |
| 36 | 44 | list's configuration is copied to the new list after the defaults |
| 37 | | files have been processed but before the command-line parameter |
| 38 | | assignments take effect. This makes it possible to copy a list's |
| 39 | | configuration "except for" some specific settings. The list and owner |
| 40 | | addresses are set immediately before the command-line parameter |
| 41 | | assignments are processed, so they will be correct for a "cloned" |
| 42 | | list; you overwrite them from the command line at your own peril. |
| | 45 | files have been processed but before the configuration files and |
| | 46 | parameter assignments given on the command line take effect. |
| | 47 | This makes it possible to copy a list's configuration "except for" |
| | 48 | some specific settings. The list and owner addresses are set immediately |
| | 49 | before the command-line parameter assignments are processed, so they will |
| | 50 | be correct for a "cloned" list; you overwrite them from the command line |
| | 51 | at your own peril. |
| | 52 | |
| | 53 | The I<owner-address> will also be subscribed to the list as an |
| | 54 | administrator. If you'd rather not have this, add the configuration |
| | 55 | parameter |
| | 56 | |
| | 57 | list.subscribeowner = 0 |
| | 58 | |
| | 59 | to one of the default files or invoke B<pl-init> like |
| | 60 | |
| | 61 | pl-init list@domain owner@domain list.subscribeowner=0 |
| | 62 | |
| 43 | 63 | |
| 44 | 64 | =head1 OPTIONS |
| … |
… |
|
| 52 | 72 | as the new list. |
| 53 | 73 | |
| 54 | | =item B<--config>=I<key>=I<value> |
| 55 | | |
| 56 | | Changes the list configuration parameter I<key> to I<value> (use |
| 57 | | quotes if I<value> contains whitespace). If B<--config> is used |
| 58 | | together with B<--clone>, the changes take place after the |
| 59 | | configuration has been cloned. There may be multiple B<--config> |
| 60 | | options on the same command line. Configuration parameters may be |
| 61 | | changed later using the B<pl-conf> command. |
| 62 | | |
| 63 | | USE QUOTES IF YOUR VALUES CONTAIN WHITESPACE. |
| | 74 | =item B<--config>=I<file> |
| | 75 | |
| | 76 | Reads configuration parameter assignments from I<file>. Empty lines |
| | 77 | and comment lines (starting with "#") in I<file> will be ignored. |
| | 78 | |
| | 79 | If B<--config> is used together with B<--clone>, the changes take |
| | 80 | place after the configuration has been cloned. There may be multiple |
| | 81 | B<--config> options on the same command line. Configuration parameters |
| | 82 | may be changed later using the B<pl-conf> command. |
| 64 | 83 | |
| 65 | 84 | =item B<--mailfilter> |
| … |
… |
|
| 93 | 112 | =head1 COPYRIGHT AND LICENSE |
| 94 | 113 | |
| 95 | | Copyright 2004 by Anselm Lingnau. This program is free software; you |
| | 114 | Copyright 2004-11 by Anselm Lingnau. This program is free software; you |
| 96 | 115 | may redistribute it and/or modify it under the terms of the GNU |
| 97 | 116 | General Public License as published by the Free Software Foundation; |
| … |
… |
|
| 130 | 149 | use Lancelot::Log qw/log/; |
| 131 | 150 | |
| 132 | | my (%opts); |
| | 151 | my %opts; |
| 133 | 152 | |
| 134 | 153 | GetOptions(\%opts, -defaults, |
| 135 | 154 | -argvmin => 2, "need list and owner address", |
| 136 | | -argvmax => 2, "too many arguments", |
| 137 | 155 | "our-isp?", "clone=", "config@", "mailfilter!"); |
| 138 | 156 | |
| 139 | | my ($listaddr, $owneraddr) = @ARGV; |
| 140 | | my (%options) = ( create => 1, ourisp => $opts{"our-isp"} ); |
| | 157 | my $listaddr = shift; |
| | 158 | my $owneraddr = (Email::Address->parse(shift))[0]; |
| | 159 | my $ownername = $owneraddr->phrase || $owneraddr->comment; |
| | 160 | |
| | 161 | my %options = ( create => 1, ourisp => $opts{"our-isp"} ); |
| 141 | 162 | |
| 142 | 163 | my $db = new Lancelot::DB $listaddr, \%options |
| … |
… |
|
| 146 | 167 | |
| 147 | 168 | $db->set_config("list.address", $listaddr); |
| 148 | | $db->set_config("list.owneraddress", $owneraddr); |
| 149 | | my ($listname) = $listaddr; |
| | 169 | $db->set_config("list.owneraddress", $owneraddr->address); |
| | 170 | $db->set_config("list.ownername", $ownername) if $ownername; |
| | 171 | my $listname = $listaddr; |
| 150 | 172 | $listname =~ s/\@.*$//; |
| 151 | 173 | $db->set_config("list.name", ucfirst($listname)); |
| 152 | 174 | |
| 153 | | $db->set_configs(@{$opts{config}}) if @{$opts{config}}; |
| | 175 | $db->set_configs_from_file($_, 0) foreach @{$opts{config}}; |
| | 176 | $db->set_configs(@ARGV) if @ARGV; |
| 154 | 177 | |
| 155 | 178 | if ($opts{"our-isp"} && !($opts{mailfilter} == 0)) { |
| … |
… |
|
| 165 | 188 | die "$0: couldn't create $mfname: $!\n"; |
| 166 | 189 | } |
| | 190 | } else { |
| | 191 | my $xlistaddr = $listaddr; |
| | 192 | my $delim = $db->get_config("mail.delimiter"); |
| | 193 | $xlistaddr =~ s/\@/${delim}ANYTHING\@/; |
| | 194 | my $user = getpwuid($<); |
| | 195 | |
| | 196 | print "Make sure that within your MTA setup, messages to\n\n"; |
| | 197 | print " $listaddr as well as\n"; |
| | 198 | print " $xlistaddr\n\n"; |
| | 199 | print "are piped into\n\n"; |
| | 200 | print " $Bin/pl-incoming --user $user $listaddr\n\n"; |
| | 201 | print "Consult Project Lancelot's Deployment-HOWTO for details.\n"; |
| | 202 | } |
| | 203 | |
| | 204 | my $subscribe_owner = $db->get_config("list.subscribeowner"); |
| | 205 | if ($subscribe_owner) { |
| | 206 | log "info", "subscribing owner address as list administrator"; |
| | 207 | unless ($db->add_address($owneraddr, { admin => 1 })) { |
| | 208 | log "err", "error subscribing $owneraddr\n"; |
| | 209 | } |
| 167 | 210 | } |
| 168 | 211 | |
-
|
r326
|
r328
|
|
| 98 | 98 | list.owneraddress|STR||Address of the list owner, for LIST+owner@DOMAIN |
| 99 | 99 | list.ownername|STR||Name of the list owner |
| | 100 | list.subscribeowner|BOOL|1|Subscribe list owner as administrator when list is created |
| 100 | 101 | mail.addheaders|STR||List of names of headers to be added to outgoing messages (put header values in »mail.header.NAME« variables) |
| 101 | 102 | mail.delimiter|STR|+|Character between list name and extensions (must match MTA setup) |