[Mailman-Users] Virtual Hosts -- can mailman handle them better?

Tomas Fasth tomas at euronetics.se
Tue Aug 17 23:55:48 CEST 1999


Okej, here's the script I use when setting up new virtual list domains.

A few comments:
I have collected all our virtual list stuff in /var/virtual/list. Lets
call it the "base". I have choosen to put the script in subdir "bin".
Many things are hardcoded. The script is assuming to be executing with
the "base" as cwd. The gzipped tarball is assumed to be in subdir "pub".
To avoid numerous pages of output from the 'configure' and 'make'
commands, a log is created in an existing subdir "log". The script
require two parameters, <user> and <domain>. The <user> is assumed to
already exist in the system.
The script creates a subdir with a name of <domain>. When it has
finished there will be two subdirs in <domain>. The source tree
"mailman-1.0" and the installation "mailman". The whole tree is owned by
<user>.
'configure' is run with parameter --with-mail-gid=<user>. This works
with exim but may not work with other MTA implementations.
Currently, 'configure' insist to figure out by itself the
DEFAULT_HOST_NAME and DEFAULT_URL defined in Mailman/mm_cfg.py. So for
now, this has to be done manually.
The mail aliases has to be defined according to the different
installation path.
The same goes for web server configuration. I use Apache <VirtualHost>.
Note that /mailman in the URL is a requirement for the cookie handling
to work properly. I found out this the hard way when I tried to optimize
the URL to "http://my.domain" skipping the /mailman. Without a broken
handling of cookies you end up entering the same admin password again
and again.

If you have any questions, just mail me.
Oh, by the way, you may not need bash to execute the script. But I
haven't bothered to test anything else.

Cheers, Tomas

-------------- next part --------------
#!/usr/bin/env bash

if [ $# -ne 2 ] ; then echo "USAGE: $0 <user> <domain>" ; exit ; fi

export listuser=$1
export listdomain=$2
export virtualbase=$PWD
export logfile=${virtualbase}/log/$listdomain
export gzippedtarball=${virtualbase}/pub/mailman-1.0.tgz

function verbose () {
    echo + $@ >&2
    $@
}

function rotate () {
    local head=$1 tail=$2 version=$3 horizon=$4
    if [ $version -lt $horizon ] ; then
        if [ -e $head.$version ] ; then
            rotate $head .$version `expr $version + 1` $horizon
        fi
        if [ -e $head$tail ] ; then
            verbose mv $head$tail $head.$version
        fi
    fi
}

rotate $logfile "" 0 10

umask 2
verbose mkdir -m a+rx,ug+w $listdomain
verbose chown $listuser.$listuser $listdomain
verbose chmod g+ws $listdomain
verbose cd $listdomain

su $listuser -- -sx ${gzippedtarball} > $logfile <<-\EOF
    mmdir=mailman
    prefix=`pwd`/$mmdir
    mkdir $mmdir
    chmod a+rx,g+ws $mmdir
    tar zxf $1
    cd mailman-1.0
    export MAILMAN_UID=`id -u` MAILMAN_GID=`id -g`
    ./configure --prefix=$prefix --with-mail-gid=`id -g` 2>&1
    make install 2>&1
EOF


More information about the Mailman-Users mailing list