14e7edb82a71d9ebe960a377faa262d9174719d1
3 # Import a mailing list from a user.
5 # This must be run as root.
8 ARCHIVEDIR
=$MMDIR/archives
14 echo "Usage: import-list [--new] [--archive MBOX-FILE] [--conf CONF-FILE]"
15 echo " [--url WEB-PAGE-URL] LIST"
19 if test -z "$1" ||
test -n "$2"; then
20 echo "Programmer error"
26 mkdir
$MMDIR/lists
/$LIST
27 chown list
:list
$MMDIR/lists
/$LIST
28 chmod g
+rwx
$MMDIR/lists
/$LIST
30 mkdir
$MMDIR/archives
/private
/$LIST
31 chown list
:list
$MMDIR/archives
/private
/$LIST
32 chmod g
+rwx
$MMDIR/archives
/private
/$LIST
34 echo "Created list $LIST"
44 while test "forever"; do
45 if test "$1" = "--archive"; then
49 elif test "$1" = "--conf"; then
54 elif test "$1" = "--new"; then
58 elif test "$1" = "--url"; then
69 echo "Not enough arguments"
72 elif test -n "$2"; then
73 echo "Too many arguments"
81 # Create list if --new passed
82 if test "$NEW" = "y"; then
86 # Check to see whether list exists yet
87 if test ! -d $LISTDIR/$LIST; then
88 echo "List $LIST does not exist yet. Please make it using the" \
93 # Make working directory
94 if test ! -d $WORKDIR; then
96 chown list
:list
$WORKDIR
97 chmod ug
=rwX
,o
= $WORKDIR
100 # Import configuration
101 if test -n "$CONF"; then
102 echo "Importing list configuration ..."
103 cp $CONF $WORKDIR/$LIST.cfg
104 chown list
:list
$WORKDIR/$LIST.cfg
105 chmod u
=rw
,g
=rw
,o
= $WORKDIR/$LIST.cfg
106 mv $WORKDIR/$LIST.cfg
$LISTDIR/$LIST/config.pck
110 # Change URL for web interface
111 if test -n "$CONF" && test -n "$URL"; then
112 echo "Changing web page URL for $LIST to $URL ..."
113 echo "web_page_url = '$URL'" > $WORKDIR/$LIST.cfg
114 chown list
:list
$WORKDIR/$LIST.cfg
115 sudo
-u list
$BINDIR/config_list
-i $WORKDIR/$LIST.cfg
$LIST
116 rm -f $WORKDIR/$LIST.cfg
120 # Import list archives
121 if test -n "$ARCH"; then
122 echo "Importing list archives ..."
123 cp $ARCH $WORKDIR/$LIST.mbox
124 rm -fr $ARCHIVEDIR/private
/$LIST.mbox
125 mkdir
$ARCHIVEDIR/private
/$LIST.mbox
126 mv $WORKDIR/$LIST.mbox
$ARCHIVEDIR/private
/$LIST.mbox
127 chown
-R list
:list
$ARCHIVEDIR/private
/$LIST.mbox
128 chmod ug
=rw
,o
=r
$ARCHIVEDIR/private
/$LIST.mbox
/$LIST.mbox
129 sudo
-u list
$BINDIR/arch
--quiet --wipe $LIST
133 echo "Reloading mailman ..."
134 /etc
/init.d
/mailman reload
137 if test -n "$CONF"; then
138 echo "Updating mailman definitions for Exim ..."
139 /afs
/hcoop.net
/common
/etc
/scripts
/mailman-update-exim-db
143 echo "Sucessfully imported list $LIST"