#!/bin/sh

set -e

OTRSHOME=/usr/share/otrs

setup_apache()
{
  if [ -e /etc/otrs/apache2-httpd.include.conf -a \
     ! -e /etc/apache2/conf.d/otrs2 ]; then
    mv /etc/otrs/apache2-httpd.include.conf /etc/apache2/conf.d/otrs2
  fi
  ucf --three-way --debconf-ok $OTRSHOME/scripts/apache2-httpd-new.include.conf \
    /etc/apache2/conf.d/otrs2
  a2enmod perl
  a2enmod rewrite
  db_stop
  invoke-rc.d apache2 force-reload
}

. /usr/share/debconf/confmodule

case "$1" in
  configure|reconfigure)
  setup_apache
  ;;

  *)
  echo "postinst called with unknown argument \`$1'" 1>&2
  exit 1
  ;;
esac

#DEBHELPER#

