Blame Identity/Webenv/Themes/Default/Moin/1.5.7/create-wiki-instance.sh

f2e824
#!/bin/bash
f2e824
# moinmoin-postinstall.sh
f2e824
# MoinMoin 1.5 instance installation script.
f2e824
#
f2e824
# The CentOS Artwork SIG.
f2e824
# http://projects.centos.org/trac/artwork/
f2e824
f2e824
f2e824
f2e824
# ---------------------------------------------------------
f2e824
# Begin Configuration Section
f2e824
f2e824
# Name of the Wiki Front Page.
f2e824
WIKIFRONTPAGE="FrontPage"
f2e824
f2e824
# Directory name where the wiki instance will be copied.
f2e824
WIKILOCATION=/var/www/
f2e824
f2e824
# Instance Name. This is the name used to create the directory under
f2e824
# $WIKILOCATION and some others internal links.
f2e824
printf "Instance Name [wiki]      : "
f2e824
read WIKIINSTANCE
f2e824
if [ ! $WIKIINSTANCE ];then
f2e824
	WIKIINSTANCE='wiki'
f2e824
fi
f2e824
f2e824
# Instance name should be uniq.
f2e824
if [ -d ${WIKILOCATION}/$WIKIINSTANCE ];then
f2e824
	echo "The instance '$WIKIINSTANCE' already exists."
f2e824
	exit;
f2e824
fi
f2e824
f2e824
# Site Name. This is the name shown in the browser title bar.
f2e824
printf "Site Name [My Wiki]       : "
f2e824
read WIKISITENAME
f2e824
if [ ! $WIKINAME ];then
f2e824
	WIKINAME='My Wiki'
f2e824
fi
f2e824
f2e824
# Alias Name used to access the wiki. By default we access
f2e824
# the wiki with the form: `http://localhost/wiki'. If you
f2e824
# want to acces the wiki with other alias name then change
f2e824
# this value and fill it with the name you want to access
f2e824
# your wiki.
f2e824
WIKIALIAS=$WIKIINSTANCE
f2e824
f2e824
# Alias name used to access wiki static files. This value
f2e824
# should be different from $WIKIALIAS above.
f2e824
WIKIURLPREFIX=${WIKIINSTANCE}_staticfiles
f2e824
f2e824
# Wiki Super User. Add your WikiUserName here.
f2e824
printf "Site superuser [YourName] : "
f2e824
read WIKISUPERUSER
f2e824
if [ ! $WIKISUPERUSER ];then
f2e824
	WIKISUPERUSER='YourName'
f2e824
fi
f2e824
f2e824
# Do you want to restrict the edit actions ?  (yes|no).
f2e824
# 
f2e824
# a) If `yes' only the wiki superuser, and those listed into
f2e824
# EditGroup and AdminGroup pages will be able to edit pages
f2e824
# on your wiki. After this script is run, we suggest to:
f2e824
#
f2e824
#    1. Register the superuser. For example:
f2e824
#	Login > UserPreferences > Create Profile
f2e824
#    2. Create a EditGroup page.
f2e824
#    3. Add registered user names into EditGroup page.
f2e824
#
f2e824
#       At this point those users listed in EditGroup will
f2e824
#       be able to edit pages on your wiki. If you need to
f2e824
#       grant admin rights to other people then create the
f2e824
#       AdminGroup page and add register users names into
f2e824
#       it. After that they will have admin rights.
f2e824
#
f2e824
#       More info about acl can be found at
f2e824
#       http://localhost/wiki/HelpOnAccessControlLists once
f2e824
#       you have installed the wiki.
f2e824
# 
f2e824
# b) If `no' all users will be able to edit your wiki. Even
f2e824
# if they haven't a user register on it.
f2e824
WIKIRESTRICTEDIT="no"
f2e824
f2e824
# Mail
f2e824
WIKIMAILSMARTHOST=""
f2e824
WIKIMAILFROM=""
f2e824
WIKIMAILLOGIN=""
f2e824
f2e824
# Language.
f2e824
WIKILANGUAGE="en"
f2e824
f2e824
# Basic installation Prefix.
f2e824
PREFIX=/usr
f2e824
f2e824
# Share directory name.
f2e824
SHARE=$PREFIX/share/moin/
f2e824
f2e824
# User & Group used by your web server.
f2e824
USER=apache
f2e824
GROUP=$USER
f2e824
f2e824
# End of Configuration section
f2e824
# ---------------------------------------------------------
f2e824
f2e824
f2e824
# Copy files
f2e824
#
f2e824
# Here we create directories and copy files into the
f2e824
# instance.
f2e824
#
f2e824
echo "Creating instance ..."
f2e824
cd $WIKILOCATION
f2e824
mkdir $WIKIINSTANCE
f2e824
cp -R ${SHARE}data $WIKIINSTANCE
f2e824
cp -R ${SHARE}htdocs $WIKIINSTANCE
f2e824
cp -R ${SHARE}underlay $WIKIINSTANCE
f2e824
mkdir ${WIKIINSTANCE}/cgi-bin
f2e824
cp ${SHARE}server/moin.cgi ${WIKIINSTANCE}/cgi-bin
f2e824
f2e824
f2e824
# Fix PATH in moin.cgi file
f2e824
#
f2e824
sed -i -e "
f2e824
        s/\/path\/to\/wikiconfig/\/var\/www\/${WIKIINSTANCE}\/cgi-bin/
f2e824
        s/\/path\/to\/farmconfig/\/var\/www\/${WIKIINSTANCE}\/cgi-bin\/farmconfig/
f2e824
        " ${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi
f2e824
f2e824
f2e824
# Apache Configuration
f2e824
#
f2e824
# Here we create the apache configuration file. By default
f2e824
# the wiki will be accessed through the `wiki' apache alias.
f2e824
# Virtual domains are also included but commented by
f2e824
# default.
f2e824
cat <<APACHECONF > /etc/httpd/conf.d/${WIKIINSTANCE}.conf
f2e824
# Apache web server configuration for MoinMoin wiki.
f2e824
#
f2e824
# Created by create-wiki-instance.sh.
f2e824
# `echo date`
f2e824
f2e824
#
f2e824
# By Alias.
f2e824
#
f2e824
Alias /${WIKIURLPREFIX} "${WIKILOCATION}${WIKIINSTANCE}/htdocs/"
f2e824
<Directory "${WIKILOCATION}${WIKIINSTANCE}/htdocs/">
f2e824
   Order deny,allow
f2e824
   Allow from all
f2e824
</Directory>
f2e824
f2e824
ScriptAlias /${WIKIINSTANCE} "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi"
f2e824
<Directory "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin">
f2e824
   Order deny,allow
f2e824
   Allow from all
f2e824
</Directory>
f2e824
f2e824
f2e824
# By Virtual Domains.
f2e824
#
f2e824
#<VirtualHost *:80>
f2e824
#   ServerName wiki.example.tld
f2e824
#   ServerAdmin webmaster@example.tld
f2e824
#   ErrorLog logs/wiki.example.tld-error_log
f2e824
#   CustomLog logs/wiki.example.tld-access_log common   
f2e824
#   Alias /${WIKIURLPREFIX} "${WIKILOCATION}${WIKIINSTANCE}/htdocs/"
f2e824
#   Alias /favicon.ico "${WIKILOCATION}${WIKIINSTANCE}/favicon.ico"
f2e824
#   ScriptAlias / "${WIKILOCATION}${WIKIINSTANCE}/cgi-bin/moin.cgi/"
f2e824
#</VirtualHost>
f2e824
APACHECONF
f2e824
f2e824
f2e824
# MoinMoin Configuration - wikiconfig.py
f2e824
#
f2e824
# Here is a copy and paste from original wikiconfig.py file
f2e824
# in the moin-1.5.7-1.el5.rf package. Some additions were
f2e824
# included in the secutiry section to make it configurablen
f2e824
# between 1) an everyone editable wiki 2) a just Superuser,
f2e824
# EditGroup, and AdminGroup editable wiki.
f2e824
cat <<WIKICONFIG > ${WIKIINSTANCE}/cgi-bin/wikiconfig.py 
f2e824
# -*- coding: iso-8859-1 -*-
f2e824
# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a
f2e824
# western country and you don't know that you use utf-8, you probably want to
f2e824
# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode
f2e824
# encoding) you MUST use: coding: utf-8
f2e824
# That setting must match the encoding your editor uses when you modify the
f2e824
# settings below. If it does not, special non-ASCII chars will be wrong.
f2e824
f2e824
"""
f2e824
    MoinMoin - Configuration for a single wiki
f2e824
f2e824
    If you run a single wiki only, you can omit the farmconfig.py config
f2e824
    file and just use wikiconfig.py - it will be used for every request
f2e824
    we get in that case.
f2e824
f2e824
    Note that there are more config options than you'll find in
f2e824
    the version of this file that is installed by default; see
f2e824
    the module MoinMoin.multiconfig for a full list of names and their
f2e824
    default values.
f2e824
f2e824
    Also, the URL http://moinmoin.wikiwikiweb.de/HelpOnConfiguration has
f2e824
    a list of config options.
f2e824
f2e824
    ** Please do not use this file for a wiki farm. Use the sample file 
f2e824
    from the wikifarm directory instead! **
f2e824
"""
f2e824
f2e824
from MoinMoin.multiconfig import DefaultConfig
f2e824
f2e824
f2e824
class Config(DefaultConfig):
f2e824
f2e824
    # Wiki identity ----------------------------------------------------
f2e824
f2e824
    # Site name, used by default for wiki name-logo [Unicode]
f2e824
    sitename = u'${WIKISITENAME}'
f2e824
f2e824
    # Wiki logo. You can use an image, text or both. [Unicode]
f2e824
    # For no logo or text, use '' - the default is to show the sitename.
f2e824
    # See also url_prefix setting below!
f2e824
    logo_string = u'MoinMoin Logo'
f2e824
f2e824
    # name of entry page / front page [Unicode], choose one of those:
f2e824
f2e824
    # a) if most wiki content is in a single language
f2e824
    #page_front_page = u"MyStartingPage"
f2e824
f2e824
    # b) if wiki content is maintained in many languages
f2e824
    page_front_page = u"${WIKIFRONTPAGE}"
f2e824
f2e824
    # The interwiki name used in interwiki links
f2e824
    #interwikiname = 'UntitledWiki'
f2e824
    # Show the interwiki name (and link it to page_front_page) in the Theme,
f2e824
    # nice for farm setups or when your logo does not show the wiki's name.
f2e824
    #show_interwiki = 1
f2e824
f2e824
f2e824
    # Critical setup  ---------------------------------------------------
f2e824
f2e824
    # Misconfiguration here will render your wiki unusable. Check that
f2e824
    # all directories are accessible by the web server or moin server.
f2e824
f2e824
    # If you encounter problems, try to set data_dir and data_underlay_dir
f2e824
    # to absolute paths.
f2e824
f2e824
    # Where your mutable wiki pages are. You want to make regular
f2e824
    # backups of this directory.
f2e824
    data_dir = '${WIKILOCATION}${WIKIINSTANCE}/data/'
f2e824
f2e824
    # Where read-only system and help page are. You might want to share
f2e824
    # this directory between several wikis. When you update MoinMoin,
f2e824
    # you can safely replace the underlay directory with a new one. This
f2e824
    # directory is part of MoinMoin distribution, you don't have to
f2e824
    # backup it.
f2e824
    data_underlay_dir = '${WIKILOCATION}${WIKIINSTANCE}/underlay/'
f2e824
f2e824
    # Location of your STATIC files (css/png/js/...) - you must NOT use the
f2e824
    # same for invoking moin.cgi (or, in general, the moin code).
f2e824
    # url_prefix must be '/wiki' for Twisted and standalone servers.
f2e824
    # For CGI, it should match your Apache Alias setting.
f2e824
    url_prefix = '/${WIKIURLPREFIX}'
f2e824
f2e824
f2e824
    # Security ----------------------------------------------------------
f2e824
f2e824
    # This is checked by some rather critical and potentially harmful actions,
f2e824
    # like despam or PackageInstaller action:
f2e824
    #superuser = [u"${WIKISUPERUSER}", ]
f2e824
f2e824
    # IMPORTANT: grant yourself admin rights! replace YourName with
f2e824
    # your user name. See HelpOnAccessControlLists for more help.
f2e824
    # All acl_rights_xxx options must use unicode [Unicode]
f2e824
    #acl_rights_default = u"All:read"
f2e824
    #acl_rights_before  = u"${WIKISUPERUSER}:read,write,delete,revert,admin" \\
f2e824
    #			 u"AdminGroup:read,write,delete,revert,admin" \\
f2e824
    #			 u"EditGroup:read,write,delete,revert"
f2e824
f2e824
    # Link spam protection for public wikis (Uncomment to enable)
f2e824
    # Needs a reliable internet connection.
f2e824
    #from MoinMoin.util.antispam import SecurityPolicy
f2e824
f2e824
f2e824
    # Mail --------------------------------------------------------------
f2e824
f2e824
    # Configure to enable subscribing to pages (disabled by default)
f2e824
    # or sending forgotten passwords.
f2e824
f2e824
    # SMTP server, e.g. "mail.provider.com" (None to disable mail)
f2e824
    #mail_smarthost = "${WIKIMAILSMARTHOST}"
f2e824
f2e824
    # The return address, e.g u"Jürgen Wiki <noreply@mywiki.org>" [Unicode]
f2e824
    #mail_from = u"${WIKIMAILFROM}"
f2e824
f2e824
    # "user pwd" if you need to use SMTP AUTH
f2e824
    #mail_login = "${WIKIMAILLOGIN}"
f2e824
f2e824
f2e824
    # User interface ----------------------------------------------------
f2e824
f2e824
    # Add your wikis important pages at the end. It is not recommended to
f2e824
    # remove the default links.  Leave room for user links - don't use
f2e824
    # more than 6 short items.
f2e824
    # You MUST use Unicode strings here, but you need not use localized
f2e824
    # page names for system and help pages, those will be used automatically
f2e824
    # according to the user selected language. [Unicode]
f2e824
    navi_bar = [
f2e824
        # If you want to show your page_front_page here:
f2e824
        #u'%(page_front_page)s',
f2e824
        u'RecentChanges',
f2e824
        u'FindPage',
f2e824
        u'SiteNavigation',
f2e824
        u'HelpContents',
f2e824
    ]
f2e824
f2e824
    # The default theme anonymous or new users get
f2e824
    theme_default = 'modern'
f2e824
f2e824
f2e824
    # Language options --------------------------------------------------
f2e824
f2e824
    # See http://moinmoin.wikiwikiweb.de/ConfigMarket for configuration in 
f2e824
    # YOUR language that other people contributed.
f2e824
f2e824
    # The main wiki language, set the direction of the wiki pages
f2e824
    language_default = '${WIKILANGUAGE}'
f2e824
f2e824
    # You must use Unicode strings here [Unicode]
f2e824
    page_category_regex = u'^Category[A-Z]'
f2e824
    page_dict_regex = u'[a-z]Dict$'
f2e824
    page_form_regex = u'[a-z]Form$'
f2e824
    page_group_regex = u'[a-z]Group$'
f2e824
    page_template_regex = u'[a-z]Template$'
f2e824
f2e824
    # Content options ---------------------------------------------------
f2e824
f2e824
    # Show users hostnames in RecentChanges
f2e824
    show_hosts = 1                  
f2e824
f2e824
    # Enable graphical charts, requires gdchart.
f2e824
    #chart_options = {'width': 600, 'height': 300}
f2e824
WIKICONFIG
f2e824
f2e824
#
f2e824
# Uncomment some options in the wikiconfig.py file if ...
f2e824
#
f2e824
f2e824
if [ "$WIKISUPERUSER" != "" ]; then
f2e824
f2e824
	sed -i -e '
f2e824
		/#superuser/s/#//
f2e824
		s/YourName/'$WIKISUPERUSER'/' ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
f2e824
f2e824
fi
f2e824
f2e824
if [ "$WIKIRESTRICTEDIT" = "yes" ]; then
f2e824
f2e824
	sed -i -r -e '
f2e824
		/#acl_rights_before/s/#//
f2e824
		/#acl_rights_default/s/#//
f2e824
		/#[\t ]*u"EditGroup/s/#//
f2e824
		/#[\t ]*u"AdminGroup/s/#//' ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
f2e824
f2e824
fi
f2e824
f2e824
if [ "$WIKIMAILSMARTHOST" != "" ]; then
f2e824
f2e824
	sed -i -e '
f2e824
		/#mail_smarthost/s/#//' ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
f2e824
f2e824
fi
f2e824
f2e824
if [ "$WIKIMAILFROM" != "" ];then
f2e824
f2e824
	sed -i -e '
f2e824
		/#mail_from/s/#//' ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
f2e824
f2e824
fi
f2e824
f2e824
if [ "$WIKIMAILLOGIN" != "" ];then
f2e824
 
f2e824
	sed -i -e '
f2e824
		/#mail_login/s/#//' ${WIKIINSTANCE}/cgi-bin/wikiconfig.py
f2e824
f2e824
fi
f2e824
f2e824
f2e824
# File Permissions
f2e824
#
f2e824
# Here we set the file permissons to the created and copied
f2e824
# files.
f2e824
#
f2e824
echo 'Setting permissions ...'
f2e824
chown -R $USER.$GROUP $WIKIINSTANCE
f2e824
chmod -R 750 $WIKIINSTANCE
f2e824
f2e824
f2e824
# Last Message
f2e824
echo '---------------------------------------------'
f2e824
echo ' *** The wiki instance had been created! *** '
f2e824
echo '---------------------------------------------'
f2e824
echo 'To finish the installation do the following:'
f2e824
echo "  1. Restart the Web Server (service httpd restart)"
f2e824
echo "  2. Open your browser and try the address: http://localhost/${WIKIALIAS}"
f2e824
echo '  3. Enjoy your installed wiki :).'
f2e824
echo ''