#!/bin/sh set -e # automatically update configuration, but only if package noosfero is also # installed if test -x /usr/share/noosfero/script/apacheconf; then 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