#!/bin/sh
set -e

if [ ! -f /etc/apache/counter.log ]
then
    echo "/0000000000" > /etc/apache/counter.log
    echo "/index.html0000000000" >> /etc/apache/counter.log
    chmod 664 /etc/apache/counter.log
    chown www.www-data /etc/apache/counter.log
fi

if [ -x /usr/sbin/apacheconfig ] \
    && ! grep /usr/lib/apache/modules/mod_fastcgi.so \
    /etc/apache/httpd.conf > /dev/null 2>&1
then
    echo -n "New modules have been installed.  Reconfigure Apache now? [y/N] "
    read REPLY
    if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]
    then
	exec /usr/sbin/apacheconfig --force-modules --update
    fi
fi
