#!/bin/sh

set -e

TEMPLATE=/usr/share/doc/cortado/examples/apache2
TARGETDIR=/etc/apache2/conf.d

# install the apache2 config file only when apache2 is actually installed
install_config() {
  if [ -x /etc/init.d/apache2 ]; then
    ucf --three-way --debconf-ok $TEMPLATE $TARGETDIR/cortado
    invoke-rc.d apache2 reload
  fi
}

. /usr/share/debconf/confmodule

case "$1" in
  configure|reconfigure)
    install_config
    ;;
  *)
    echo "postinst called with unknown argument \`$1'" 1>&2
    exit 1
    ;;
esac

#DEBHELPER#

