Move hcoop vhost config into sites-available
[hcoop/zz_old/debian/hcoop-apache2-config.git] / debian / hcoop-apache2-config.postinst
index a6c0b58..9df107d 100644 (file)
@@ -18,13 +18,30 @@ set -e
 # the debian-policy package
 
 
+# make sure to keep in sync with prerm
+HCOOP_APACHE_MODULES="auth_kerb cache dav dav_fs dav_lock disk_cache expires include mime_magic negotiation proxy proxy_http rewrite ssl status suexec suphp waklog"
+
 case "$1" in
     configure)
-       if [ -z "$2" ]; then
-           a2enmod -q waklog
-       fi
 
-       if [ -e "/etc/apache2/mods-enabled/waklog.load" ]; then
+       # Redundantly enable on upgrades in case some new modules were
+       # enabled
+       for mod in $HCOOP_APACHE_MODULES; do
+           a2enmod -q $mod
+       done
+
+       # Enable vhosts. This has to be in sites-enabled so that
+       # 000default is loaded before member vhosts
+       a2ensite hcoop-vhosts
+       
+       HCOOP_ENABLE_FAILED=0
+       for mod in $HCOOP_APACHE_MODULES; do
+           if [ ! -e "/etc/apache2/modules-enabled/${mod}.load" ]; then
+               HCOOP_ENABLED_FAILED=1
+           fi
+       done
+
+       if [ ! $HCOOP_ENABLE_FAILED ]; then
            invoke-rc.d apache2 restart
        fi
     ;;