|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
# moinmoin-postinstall.sh
|
|
|
4c79b5 |
# MoinMoin 1.5 instance installation script.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# The CentOS Artwork SIG.
|
|
|
4c79b5 |
# http://projects.centos.org/trac/artwork/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# ---------------------------------------------------------
|
|
|
4c79b5 |
# Begin Configuration Section
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
WIKIFRONTPAGE="FrontPage"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
WIKILOCATION=/var/www/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# $WIKILOCATION and some others internal links.
|
|
|
4c79b5 |
printf "Instance Name [wiki] : "
|
|
|
4c79b5 |
read WIKIINSTANCE
|
|
|
4c79b5 |
if [ ! $WIKIINSTANCE ];then
|
|
|
4c79b5 |
WIKIINSTANCE='wiki'
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ -d ${WIKILOCATION}/$WIKIINSTANCE ];then
|
|
|
4c79b5 |
echo "The instance '$WIKIINSTANCE' already exists."
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
printf "Site Name [My Wiki] : "
|
|
|
4c79b5 |
read WIKISITENAME
|
|
|
4c79b5 |
if [ ! $WIKINAME ];then
|
|
|
4c79b5 |
WIKINAME='My Wiki'
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# want to acces the wiki with other alias name then change
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
WIKIALIAS=$WIKIINSTANCE
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Alias name used to access wiki static files. This value
|
|
|
4c79b5 |
# should be different from $WIKIALIAS above.
|
|
|
4c79b5 |
WIKIURLPREFIX=${WIKIINSTANCE}_staticfiles
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
printf "Site superuser [YourName] : "
|
|
|
4c79b5 |
read WIKISUPERUSER
|
|
|
4c79b5 |
if [ ! $WIKISUPERUSER ];then
|
|
|
4c79b5 |
WIKISUPERUSER='YourName'
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Login > UserPreferences > Create Profile
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# 3. Add registered user names into EditGroup page.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# At this point those users listed in EditGroup will
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# grant admin rights to other people then create the
|
|
|
4c79b5 |
# AdminGroup page and add register users names into
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# More info about acl can be found at
|
|
|
4c79b5 |
# http://localhost/wiki/HelpOnAccessControlLists once
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
WIKIRESTRICTEDIT="no"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Mail
|
|
|
4c79b5 |
WIKIMAILSMARTHOST=""
|
|
|
4c79b5 |
WIKIMAILFROM=""
|
|
|
4c79b5 |
WIKIMAILLOGIN=""
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Language.
|
|
|
4c79b5 |
WIKILANGUAGE="en"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Basic installation Prefix.
|
|
|
4c79b5 |
PREFIX=/usr
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Share directory name.
|
|
|
4c79b5 |
SHARE=$PREFIX/share/moin/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
USER=apache
|
|
|
4c79b5 |
GROUP=$USER
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# End of Configuration section
|
|
|
4c79b5 |
# ---------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Copy files
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# instance.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
echo "Creating instance ..."
|
|
|
4c79b5 |
cd $WIKILOCATION
|
|
|
4c79b5 |
mkdir $WIKIINSTANCE
|
|
|
4c79b5 |
cp -R ${SHARE}data $WIKIINSTANCE
|
|
|
4c79b5 |
cp -R ${SHARE}htdocs $WIKIINSTANCE
|
|
|
4c79b5 |
cp -R ${SHARE}underlay $WIKIINSTANCE
|
|
|
4c79b5 |
mkdir ${WIKIINSTANCE}/cgi-bin
|
|
|
4c79b5 |
cp ${SHARE}server/moin.cgi ${WIKIINSTANCE}/cgi-bin
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Fix PATH in moin.cgi file
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
sed -i -e "
|
|
|
4c79b5 |
s/\/path\/to\/wikiconfig/\/var\/www\/${WIKIINSTANCE}\/cgi-bin/
|
|
|
4c79b5 |
s/\/path\/to\/farmconfig/\/var\/www\/${WIKIINSTANCE}\/cgi-bin\/farmconfig/
|
|
|
4c79b5 |
" ${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Apache Configuration
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# default.
|
|
|
4c79b5 |
cat <<APACHECONF > /etc/httpd/conf.d/${WIKIINSTANCE}.conf
|
|
|
4c79b5 |
# Apache web server configuration for MoinMoin wiki.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Created by create-wiki-instance.sh.
|
|
|
4c79b5 |
# `echo date`
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# By Alias.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
Alias /${WIKIURLPREFIX} "${WIKILOCATION}${WIKIINSTANCE}/htdocs/"
|
|
|
4c79b5 |
<Directory "${WIKILOCATION}${WIKIINSTANCE}/htdocs/">
|
|
|
4c79b5 |
Order deny,allow
|
|
|
4c79b5 |
Allow from all
|
|
|
4c79b5 |
</Directory>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
ScriptAlias /${WIKIINSTANCE} "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi"
|
|
|
4c79b5 |
<Directory "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin">
|
|
|
4c79b5 |
Order deny,allow
|
|
|
4c79b5 |
Allow from all
|
|
|
4c79b5 |
</Directory>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# By Virtual Domains.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
#<VirtualHost *:80>
|
|
|
4c79b5 |
# ServerName wiki.example.tld
|
|
|
4c79b5 |
# ServerAdmin webmaster@example.tld
|
|
|
4c79b5 |
# ErrorLog logs/wiki.example.tld-error_log
|
|
|
4c79b5 |
# CustomLog logs/wiki.example.tld-access_log common
|
|
|
4c79b5 |
# Alias /${WIKIURLPREFIX} "${WIKILOCATION}${WIKIINSTANCE}/htdocs/"
|
|
|
4c79b5 |
# Alias /favicon.ico "${WIKILOCATION}${WIKIINSTANCE}/favicon.ico"
|
|
|
4c79b5 |
# ScriptAlias / "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi/"
|
|
|
4c79b5 |
#</VirtualHost>
|
|
|
4c79b5 |
APACHECONF
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# MoinMoin Configuration - wikiconfig.py
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# in the moin-1.5.7-1.el5.rf package. Some additions were
|
|
|
4c79b5 |
# included in the secutiry section to make it configurablen
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# EditGroup, and AdminGroup editable wiki.
|
|
|
4c79b5 |
cat <<WIKICONFIG > ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
|
|
|
4c79b5 |
# -*- coding: iso-8859-1 -*-
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
"""
|
|
|
4c79b5 |
MoinMoin - Configuration for a single wiki
|
|
|
4c79b5 |
|
|
|
4c79b5 |
If you run a single wiki only, you can omit the farmconfig.py config
|
|
|
4c79b5 |
file and just use wikiconfig.py - it will be used for every request
|
|
|
4c79b5 |
we get in that case.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
Note that there are more config options than you'll find in
|
|
|
4c79b5 |
the version of this file that is installed by default; see
|
|
|
4c79b5 |
the module MoinMoin.multiconfig for a full list of names and their
|
|
|
4c79b5 |
default values.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
Also, the URL http:
|
|
|
4c79b5 |
a list of config options.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
** Please do not use this file for a wiki farm. Use the sample file
|
|
|
4c79b5 |
from the wikifarm directory instead! **
|
|
|
4c79b5 |
"""
|
|
|
4c79b5 |
|
|
|
4c79b5 |
from MoinMoin.multiconfig import DefaultConfig
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
class Config(DefaultConfig):
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Site name, used by default for wiki name-logo [Unicode]
|
|
|
4c79b5 |
sitename = u'${WIKISITENAME}'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
logo_string = u''
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#page_front_page = u"MyStartingPage"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# b) if wiki content is maintained in many languages
|
|
|
4c79b5 |
page_front_page = u"${WIKIFRONTPAGE}"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# If you encounter problems, try to set data_dir and data_underlay_dir
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
data_dir = '${WIKILOCATION}${WIKIINSTANCE}/data/'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
data_underlay_dir = '${WIKILOCATION}${WIKIINSTANCE}/underlay/'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# same for invoking moin.cgi (or, in general, the moin code).
|
|
|
4c79b5 |
# url_prefix must be '/wiki' for Twisted and standalone servers.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
url_prefix = '/${WIKIURLPREFIX}'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#superuser = [u"${WIKISUPERUSER}", ]
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#acl_rights_default = u"All:read"
|
|
|
4c79b5 |
#acl_rights_before = u"${WIKISUPERUSER}:read,write,delete,revert,admin" \\
|
|
|
4c79b5 |
# u"AdminGroup:read,write,delete,revert,admin" \\
|
|
|
4c79b5 |
# u"EditGroup:read,write,delete,revert"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Link spam protection for public wikis (Uncomment to enable)
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#from MoinMoin.util.antispam import SecurityPolicy
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# SMTP server, e.g. "mail.provider.com" (None to disable mail)
|
|
|
4c79b5 |
#mail_smarthost = "${WIKIMAILSMARTHOST}"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# The return address, e.g u"Jürgen Wiki <noreply@mywiki.org>" [Unicode]
|
|
|
4c79b5 |
#mail_from = u"${WIKIMAILFROM}"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#mail_login = "${WIKIMAILLOGIN}"
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
navi_bar = [
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
u'RecentChanges',
|
|
|
4c79b5 |
u'FindPage',
|
|
|
4c79b5 |
u'SiteNavigation',
|
|
|
4c79b5 |
u'HelpContents',
|
|
|
4c79b5 |
]
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# The default theme anonymous or new users get
|
|
|
4c79b5 |
theme_default = 'modern'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
language_default = '${WIKILANGUAGE}'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
page_category_regex = u'^Category[A-Z]'
|
|
|
4c79b5 |
page_dict_regex = u'[a-z]Dict$'
|
|
|
4c79b5 |
page_form_regex = u'[a-z]Form$'
|
|
|
4c79b5 |
page_group_regex = u'[a-z]Group$'
|
|
|
4c79b5 |
page_template_regex = u'[a-z]Template$'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
show_hosts = 1
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#chart_options = {'width': 600, 'height': 300}
|
|
|
4c79b5 |
WIKICONFIG
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Uncomment some options in the wikiconfig.py file if ...
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ "$WIKISUPERUSER" != "" ]; then
|
|
|
4c79b5 |
|
|
|
4c79b5 |
sed -i -e '
|
|
|
4c79b5 |
/#superuser/s/
|
|
|
4c79b5 |
s/YourName/'$WIKISUPERUSER'/' ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ "$WIKIRESTRICTEDIT" = "yes" ]; then
|
|
|
4c79b5 |
|
|
|
4c79b5 |
sed -i -r -e '
|
|
|
4c79b5 |
/#acl_rights_before/s/
|
|
|
4c79b5 |
/#acl_rights_default/s/
|
|
|
4c79b5 |
/#[\t ]*u"EditGroup/s/
|
|
|
4c79b5 |
/#[\t ]*u"AdminGroup/s/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ "$WIKIMAILSMARTHOST" != "" ]; then
|
|
|
4c79b5 |
|
|
|
4c79b5 |
sed -i -e '
|
|
|
4c79b5 |
/#mail_smarthost/s/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ "$WIKIMAILFROM" != "" ];then
|
|
|
4c79b5 |
|
|
|
4c79b5 |
sed -i -e '
|
|
|
4c79b5 |
/#mail_from/s/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if [ "$WIKIMAILLOGIN" != "" ];then
|
|
|
4c79b5 |
|
|
|
4c79b5 |
sed -i -e '
|
|
|
4c79b5 |
/#mail_login/s/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# File Permissions
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# files.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
echo 'Setting permissions ...'
|
|
|
4c79b5 |
chown -R $USER.$GROUP $WIKIINSTANCE
|
|
|
4c79b5 |
chmod -R 750 $WIKIINSTANCE
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Last Message
|
|
|
4c79b5 |
echo '---------------------------------------------'
|
|
|
4c79b5 |
echo ' *** The wiki instance had been created! *** '
|
|
|
4c79b5 |
echo '---------------------------------------------'
|
|
|
4c79b5 |
echo 'To finish the installation do the following:'
|
|
|
4c79b5 |
echo " 1. Restart the Web Server (service httpd restart)"
|
|
|
4c79b5 |
echo " 2. Open your browser and try the address: http://localhost/${WIKIALIAS}"
|
|
|
4c79b5 |
echo ' 3. Enjoy your installed wiki :).'
|
|
|
4c79b5 |
echo ''
|