#!/bin/bash # simple script to setup apache function bail { echo "ERROR:" "$@" exit 1 } function warn { echo "ERROR:" "$@" } # Where are we? [[ -z "$GUMP_HOME" ]] && bail "\$GUMP_HOME not set!" ### ### Settings ### APACHE_VERSION=2.0.54 APACHE_INSTALL=$GUMP_HOME/webgump/lib/apache2-install ### ### Install apache ### if [[ ! -d "$APACHE_INSTALL/current" ]]; then mkdir $APACHE_INSTALL cd $APACHE_INSTALL if [[ ! -d "$APACHE_INSTALL/httpd-$APACHE_VERSION" ]]; then wget http://apache.surfnet.nl/httpd/httpd-$APACHE_VERSION.tar.gz || bail "Downloading httpd-$APACHE_VERSION failed! maybe there is a new version? Change APACHE_VERSION in webgump/bin/get-apache as appropriate" tar zxf httpd-$APACHE_VERSION.tar.gz || bail "Corrupt tarball?" fi cd $APACHE_INSTALL/httpd-$APACHE_VERSION || bail ./configure --prefix=$APACHE_INSTALL/current --enable-mods-shared=most || bail "Apache config failed!" make || bail "Apache build failed!" make install || bail "Apache build failed!" else warn "It appears apache is already installed at" warn " $APACHE_INSTALL/current" warn "We won't attempt re-install" fi ### ### Install mod_python ### $GUMP_HOME/webgump/bin/get-mod-python || bail "mod_python download failed!" ### ### Use our own config ### if [[ -d "$APACHE_INSTALL/current/conf.dist" ]]; then echo "WARNING appears our custom apache config is already installed at" echo "WARNING $APACHE_INSTALL/current/conf" echo "WARNING We won't attempt re-install" else echo "Installing config..." cd $APACHE_INSTALL/current mv conf conf.dist ln -s $GUMP_HOME/webgump/conf cd conf fi # Write the basic path-dependent config settings into a seperate file host=`hostname -s` if [[ -f "$GUMP_HOME/webgump/conf/$host.conf" ]]; then echo "WARNING appears machine specific apache config is already installed at" echo "WARNING $GUMP_HOME/webgump/conf/$host.conf" echo "WARNING We won't attempt re-install" else echo "Installing machine-specific config" cat > $GUMP_HOME/webgump/conf/$host.conf < Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all AddHandler python-program .py PythonHandler handler::Handler.handle PythonPath "sys.path+['$GUMP_HOME/webgump/conf', '$GUMP_HOME/webgump/htdocs/app', '$GUMP_HOME/webgump/lib/python', '$GUMP_HOME/pygump/python']" PythonDebug On Order allow,deny Allow from all Options +Includes SetOutputFilter INCLUDES AcceptPathInfo On ENDECHO fi ### ### Done. Report! ### cat <