If you are not root on a computer, you usually cannot install a webserver and moin. Or maybe you would like to have your own private wiki for various purpose.

Here is a small script that install moin in the homedir, and launch the webserver with a browser.

# TODO
# choose a random port, instead of a fixed one
# copy the wiki from another location
#

CONFIG=~/.moinmoin
URL=http://localhost:8080/
PYTHONPATH=${PYTHONPATH=.}
export PYTHONPATH=${PYTHONPATH}:${CONFIG}

if [ ! -d $CONFIG ]; then
(
    mkdir -p $CONFIG
    # TODO ue ln or -l ?
    cp -ra /usr/share/moin/data $CONFIG
    cp -ra /usr/share/moin/htdocs/ $CONFIG/wiki-htdocs
    #rm -Rf $CONFIG/applets/
    cp -a /usr/share/moin/cgi-bin/* $CONFIG
    echo "httpd_docs = '.'" >>  $CONFIG/moin_config.py
    PORT=$(( 9000 + $(id -u)))
    echo "httpd_port = $PORT " >>  $CONFIG/moin_config.py
) 2>/dev/null
fi
PORT=$(python -c "from MoinMoin import config
print config.httpd_port
" )
URL=http://localhost:$PORT/

(
cd $CONFIG
# adapt it to the correct path
# maybe the correct url too ?
exec python -u -O /usr/lib/python$(rpm --eval %pyver)/site-packages/MoinMoin/httpdmain.py $*
) 2>/dev/null  &
SERV_PID=$!

# we should wait, but how long
sleep 2
# launch a web browser ?
$BROWSER $URL
kill $SERV_PID

MoinMoin: ScriptMarket/StandAloneServer (last edited 2007-10-29 19:09:36 by localhost)