--- smokeping.postinst.orig 2015-07-01 12:51:38.572127267 +0200 +++ smokeping.postinst 2015-07-01 12:49:13.820129487 +0200 @@ -38,17 +38,36 @@ setup_apache() { # note that this is only done on initial installations if [ -d /etc/apache2/conf.d ] && \ - [ ! -e /etc/apache2/conf.d/smokeping ] && \ which apache2ctl >/dev/null 2>&1 then - if apache2ctl configtest 2>/dev/null; then - echo "enabling Apache configuration in /etc/apache2/conf.d/smokeping" 1>&2 - ln -s /etc/smokeping/apache2.conf /etc/apache2/conf.d/smokeping + if [ ! -e /etc/apache2/conf.d/smokeping ] + then if apache2ctl configtest 2>/dev/null; then - invoke-rc.d apache2 force-reload || true + echo "enabling Apache configuration in /etc/apache2/conf.d/smokeping" 1>&2 + ln -s /etc/smokeping/apache2.conf /etc/apache2/conf.d/smokeping + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + fi + else + echo "broken Apache configuration detected, not enabling /etc/smokeping/apache2.conf" 1>&2 + fi + fi + elif [ -d /etc/apache2/conf-available ] && \ + which apache2ctl >/dev/null 2>&1 \ + which a2enconf >/dev/null 2>&1 + then + if [ ! -e /etc/apache2/conf-available/smokeping.conf ] + then + if apache2ctl configtest 2>/dev/null; then + echo "enabling Apache configuration in /etc/apache2/conf-available/smokeping.conf" 1>&2 + ln -s /etc/smokeping/apache2.conf /etc/apache2/conf-available/smokeping.conf + a2enconf smokeping + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + fi + else + echo "broken Apache configuration detected, not enabling /etc/smokeping/apache2.conf" 1>&2 fi - else - echo "broken Apache configuration detected, not enabling /etc/smokeping/apache2.conf" 1>&2 fi else echo "non-standard Apache configuration or missing apache2ctl, not enabling /etc/smokeping/apache2.conf" 1>&2