Code

Updated faiSummary to be w3c conform
[gosa.git] / gosa-core / debian / gosa.postinst
old mode 100755 (executable)
new mode 100644 (file)
index bcf54d1..ae1081d
@@ -1,64 +1,77 @@
-#! /bin/sh
-# GOsa postinst script
+#!/bin/sh
+# postinst script for gosa
+#
+# see: dh_installdeb(1)
 
-#DEBHELPER#
+set -e
 
-# We exit unless the package is being configured
 case "$1" in
-        abort*upgrade)         exit 0;;
-        abort*remove)          exit 0;;
-        abort*deconfigure)     exit 0;;
-        configure) ;;
-        *)                     exit 0;
+  configure)
+      ;;
+
+  abort-upgrade|abort-remove|abort-deconfigure)
+      ;;
+
+  *)
+      echo "postinst called with unknown argument \`$1'" >&2
+      exit 1
+      ;;
 esac
 
-# Get apache versions running
-servers=""
-for srv in apache apache-ssl apache2; do
-       if [ -x /usr/sbin/$srv ]; then
-                servers="$srv $servers"
-       fi
-done
+#DEBHELPER#
 
-for server in $servers; do
+# Set ID's
+WEBUSER="www-data"
+WEBGROUP="www-data"
 
-        # Set ID's
-        WEBUSER="www-data"
-        WEBGROUP="www-data"
+# Create empty inclusion file for apache
+if [ ! -f /etc/gosa/gosa.secrets ]; then
+    touch /etc/gosa/gosa.secrets
+    chmod 600 /etc/gosa/gosa.secrets
+fi
 
-       # Copy GOsa apache.conf to conf.d directories
-       if [ ! -f /etc/$server/conf.d/gosa.conf ]; then
-               echo "Making /gosa available in /etc/$server/conf.d"
+# Copy GOsa configuration to conf.d directories
+if [ ! -L /etc/apache2/conf.d/gosa.conf ]; then
 
-               # Add GOsa include file
-               cp /etc/gosa/apache.conf /etc/$server/conf.d/gosa.conf
-       fi
+  # Remove old instances of this file
+  if [ -f /etc/apache2/conf.d/gosa.conf ]; then
+    echo "Found old gosa apache configuration in /etc/apache2/conf.d - moving it to gosa.conf.orig..."
+    echo "Please check for changes in /etc/gosa/gosa-apache.conf if you modified this file!"
+    mv /etc/apache2/conf.d/gosa.conf /etc/apache2/conf.d/gosa.conf.orig
+  fi
 
-done
+  echo "Making /gosa available in /etc/apache2/conf.d"
 
-# Make compile directory writeable for webuser
-chown root.$WEBGROUP -R /var/spool/gosa
-chmod 770 -R /var/spool/gosa
+  # Add GOsa include file
+  ln -s /etc/gosa/gosa-apache.conf /etc/apache2/conf.d/gosa.conf
+fi
 
 # Add links for safe mode
 [ ! -d /usr/share/gosa/bin ] && mkdir -p /usr/share/gosa/bin
 for source in /usr/bin/convert /usr/bin/lpstat; do
-       if [ -e $source ]; then
-               target=/usr/share/gosa/bin/${source##*/}
-               [ ! -L $target ] && ln -sf $source $target
-       fi
+  if [ -e $source ]; then
+    target=/usr/share/gosa/bin/${source##*/}
+    [ ! -L $target ] && ln -sf $source $target
+  fi
 done
 
-# Update gosa
-/usr/sbin/update-gosa
+# Fix permission in /var/(spool|cache)/gosa
+chown root.$WEBGROUP -R /var/spool/gosa
+chmod 770 -R /var/spool/gosa
+chown root.$WEBGROUP -R /var/cache/gosa
+chmod 770 -R /var/cache/gosa
+
+# Add support for RequestHeader
+a2enmod headers
+
+update-gosa
 
 # Finally restart servers
-for server in $servers; do
-       if [ -x /usr/sbin/invoke-rc.d ]; then
-               invoke-rc.d $server restart
-       else
-               /etc/init.d/$server restart
-       fi
-done
+if [ -x /usr/sbin/invoke-rc.d ]; then
+  invoke-rc.d apache2 reload
+else
+  /etc/init.d/apache2 reload
+fi
 
 exit 0
+