X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=debian%2Fpazpar2-apache2.postinst;h=29a837a903e98dc7813917357621fcbe3dae7cd6;hb=64dccf5757a22cedd3c21ca834e3e02f39dd0504;hp=1dd77a511c87d29fed548e446c99c734a7ebe517;hpb=f7b3a88dd76d98d78f1de73262ca18887b74ad3d;p=pazpar2-moved-to-github.git diff --git a/debian/pazpar2-apache2.postinst b/debian/pazpar2-apache2.postinst index 1dd77a5..29a837a 100644 --- a/debian/pazpar2-apache2.postinst +++ b/debian/pazpar2-apache2.postinst @@ -1,7 +1,36 @@ #!/bin/sh set -e -if [ ! -f /etc/apache2/mods-enabled/proxy_http.load ]; then - a2enmod proxy_http + +if [ "$1" != "configure" ]; then + exit 0 fi +reload_apache() +{ + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + else + echo "Your apache2 configuration is broken, so we're not restarting it for you." + fi +} + +if [ -e /etc/apache2/apache2.conf ]; then + if [ -d /etc/apache2/conf.d ]; then + ln -sf /etc/pazpar2/ap2pazpar2-js.cfg /etc/apache2/conf.d/pazpar2-js + fi + + if [ ! -f /etc/apache2/mods-enabled/proxy_http.load ]; then + a2enmod proxy_http || true + fi + + if [ -d /etc/apache2/conf.d ]; then + ln -sf /etc/pazpar2/ap2pazpar2.cfg /etc/apache2/conf.d/pazpar2 + + if [ -f /etc/apache2/conf.d/ap2pazpar2.cfg ]; then + rm /etc/apache2/conf.d/ap2pazpar2.cfg + fi + fi + + reload_apache +fi exit 0