3 # Mailman mass-modification tool to make mailing lists private
6 # Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
9 # This file is part of FusionForge. FusionForge is free software;
10 # you can redistribute it and/or modify it under the terms of the
11 # GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the Licence, or (at your option)
15 # FusionForge is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along
21 # with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 print -u2 "Usage: ${me##*/} [-r user@host] -a | listname ..."
28 print -u2 "The argument to -r is passed unquoted to ssh."
34 while getopts "ahr:" ch; do
46 if [[ -n $rflag ]]; then
47 set -A cmd -- /bin/mksh -s --
48 (( aflag )) && set -A cmd+ -- -a
49 # does not work yet: set -A cmd+ -- "${x[@]@Q}"
50 for x in "${args[@]}"; do
51 set -A cmd+ -- "${x@Q}"
53 exec ssh $rflag "${cmd[@]}" <"$me"
57 (( aflag || nargs )) || usage
58 (( aflag && nargs )) && usage
61 set -A args -- $(/usr/lib/mailman/bin/list_lists -b)
64 print No lists to process.
70 for x in "${args[@]}"; do
71 print -nr "Processing list ${x}..."
72 if ! cf=$(/usr/lib/mailman/bin/config_list -o - "$x"); then
73 print " failed to read: $?"
78 print " failed to read: empty configuration"
82 if ! et=$(/usr/lib/mailman/bin/config_list -c -i /dev/stdin \
83 "$x" <<<"$cf" 2>&1); then
84 print " failed to read: invalid configuration"
93 for cfl in "${cfa[@]}"; do
98 (subscribe_policy*([ ])=*)
99 cfl='subscribe_policy = 3'
101 (private_roster*([ ])=*([ ])2)
103 (private_roster*([ ])=*)
104 cfl='private_roster = 1'
106 (archive_private*([ ])=*)
107 cfl='archive_private = 1'
112 if ! et=$(/usr/lib/mailman/bin/config_list -i /dev/stdin \
113 "$x" <<<"$cfo" 2>&1); then
114 print " failed to configure: $?"
115 sed 's/^/ /' <<<"$et"