Blame Identity/Models/Html/Moin/create-wiki-instance.sh

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