cirandas.net

ref: master

debian/update-noosfero-apache


#!/bin/sh

set -e

# automatically update configuration, but only if package noosfero is also
# installed
if test -x /usr/share/noosfero/script/apacheconf; then

  old_apache_site='/etc/apache2/sites-available/noosfero'
  apache_site='/etc/apache2/sites-available/noosfero.conf'

  # migrate from apache 2.2 to 2.4+
  if [ ! -f "$apache_site" -a -f "$old_apache_site" ]; then
    mv "$old_apache_site" "$apache_site"
  fi

  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"
  fi

  # remove old way to include chat config
  pattern="Include \/usr\/share\/noosfero\/util\/chat\/apache\/xmpp.conf"
  if cat $apache_site | grep "^ *$pattern" > /dev/null ; then
    echo "Removing obsolete chat configuration ..."
    sed -i "/.*$pattern.*/d" $apache_site
  fi

  echo 'Noosfero Apache configuration updated.'
  echo "Run '/etc/init.d/apache2 reload' to activate new configuration!"
fi