Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

82 lines (62 sloc) 2.597 kb
#! /bin/sh
set -e
#DEBHELPER#
confdir=/usr/share/pyshared/sapling/etc/install_config
datadir=/usr/share/localwiki
case "$1" in
configure)
# we want our setup to run last, so just activate our trigger
dpkg-trigger localwiki-setup
;;
triggered)
# do the real work here
cd "$confdir"
echo "Configuring jetty ..."
./setup_jetty.sh
if [ ! -d "$datadir/env" ]; then
echo "Creating virtualenv ..."
fi
# run virtualenv, even if it's been created, to upgrade python executable
cd "$datadir"
virtualenv --quiet env
. "$datadir/env/bin/activate"
cd "$confdir"
echo "Installing required python packages ..."
pip install --upgrade -r requirements.txt
deactivate
# For Ubuntu 11.10, 12.04 (with PostgreSQL 9.1), we have an issue with
# GeoDjango. We have to turn off standard string formatting. We can
# re-enable it once it's fixed, in Django 1.3.2
if [ -d "/etc/postgresql/9.1/main" ]
then
echo "#" >> /etc/postgresql/9.1/main/postgresql.conf
echo "# Following line added by localwiki" >> /etc/postgresql/9.1/main/postgresql.conf
echo "standard_conforming_strings = off" >> /etc/postgresql/9.1/main/postgresql.conf
echo "#" >> /etc/postgresql/9.1/main/postgresql.conf
/etc/init.d/postgresql restart
fi
echo "Configuring localwiki ..."
localwiki-manage setup_all
# Enable mod_wsgi
a2enmod wsgi > /dev/null 2>&1
# If first time setup, initialize site and wiki
if [ ! -d "$datadir/deploy" ]; then
echo "Configuring apache ..."
mkdir "$datadir/deploy"
cp "$confdir/localwiki.wsgi.template" "$datadir/deploy/localwiki.wsgi"
cp "$confdir/apache.conf.template" "/etc/apache2/sites-available/example.com"
# Allow apache to save uploads
chown www-data:www-data "$datadir/media"
# Enable mod_headers
a2enmod headers > /dev/null 2>&1
# Disable default apache site
[ -e /etc/apache2/sites-enabled/000-default ] && a2dissite default > /dev/null 2>&1
# Enable localwiki site
a2ensite example.com > /dev/null 2>&1
/etc/init.d/apache2 restart
echo "LocalWiki site enabled. Configuration in /etc/apache2/sites-available/example.com"
fi
# Ask mod_wsgi to reload
touch "$datadir/deploy/localwiki.wsgi"
;;
esac
Jump to Line
Something went wrong with that request. Please try again.