#!/bin/sh set -e # automatically update configuration, but if package noosfero is also installed if test -x /usr/share/noosfero/script/apacheconf; then datadir="/etc/noosfero/apache" mongrel_file="$datadir/mongrel.conf" cluster_file="$datadir/cluster.conf" if test -e "$cluster_file"; then echo "Overwriting $cluster_file ..." fi /usr/share/noosfero/script/apacheconf thin > "$cluster_file" if test -e "$mongrel_file"; then echo "Moving existing $mongrel_file away ..." mv "$mongrel_file" "$mongrel_file".bak (cd $datadir && ln -sf cluster.conf mongrel.conf) fi apache_site='/etc/apache2/sites-available/noosfero' if ! test -e "$apache_site"; then echo "Generating apache virtual host ..." cd /usr/share/noosfero && su noosfero -c "RAILS_ENV=production ./script/apacheconf virtualhosts" > "$apache_site" else pattern="Include \/etc\/noosfero\/apache\/virtualhost.conf" include="Include \/usr\/share\/noosfero\/util\/chat\/apache\/xmpp.conf" if ! cat $apache_site | grep "^ *$include" > /dev/null ; then echo "Updating apache virtual host ..." sed -i "s/.*$pattern.*/ $include\n&/" $apache_site fi fi echo 'Noosfero Apache configuration updated.' echo "Run '/etc/init.d/apache2 reload' to activate new configuration!" fi