Code

Added check for plain file. Closes #541
[gosa.git] / gosa-core / debian / gosa.postinst
1 #!/bin/sh
2 # postinst script for gosa
3 #
4 # see: dh_installdeb(1)
6 set -e
8 case "$1" in
9   configure)
10       ;;
12   abort-upgrade|abort-remove|abort-deconfigure)
13       ;;
15   *)
16       echo "postinst called with unknown argument \`$1'" >&2
17       exit 1
18       ;;
19 esac
21 #DEBHELPER#
23 # Set ID's
24 WEBUSER="www-data"
25 WEBGROUP="www-data"
27 # Create empty inclusion file for apache
28 if [ ! -f /etc/gosa/gosa.secrets ]; then
29     touch /etc/gosa/gosa.secrets
30     chmod 600 /etc/gosa/gosa.secrets
31 fi
33 # Copy GOsa configuration to conf.d directories
34 if [ ! -L /etc/apache2/conf.d/gosa.conf ]; then
36   # Remove old instances of this file
37   if [ -f /etc/apache2/conf.d/gosa.conf ]; then
38     echo "Found old gosa apache configuration in /etc/apache2/conf.d - moving it to gosa.conf.orig..."
39     echo "Please check for changes in /etc/gosa/gosa-apache.conf if you modified this file!"
40     mv /etc/apache2/conf.d/gosa.conf /etc/apache2/conf.d/gosa.conf.orig
41   fi
43   echo "Making /gosa available in /etc/apache2/conf.d"
45   # Add GOsa include file
46   ln -s /etc/gosa/gosa-apache.conf /etc/apache2/conf.d/gosa.conf
47 fi
49 # Add links for safe mode
50 [ ! -d /usr/share/gosa/bin ] && mkdir -p /usr/share/gosa/bin
51 for source in /usr/bin/convert /usr/bin/lpstat; do
52   if [ -e $source ]; then
53     target=/usr/share/gosa/bin/${source##*/}
54     [ ! -L $target ] && ln -sf $source $target
55   fi
56 done
58 # Fix permission in /var/(spool|cache)/gosa
59 chown root.$WEBGROUP -R /var/spool/gosa
60 chmod 770 -R /var/spool/gosa
61 chown root.$WEBGROUP -R /var/cache/gosa
62 chmod 770 -R /var/cache/gosa
64 # Add support for RequestHeader
65 a2enmod headers
67 # Update gosa
68 /usr/sbin/update-gosa
70 # Finally restart servers
71 if [ -x /usr/sbin/invoke-rc.d ]; then
72   invoke-rc.d apache2 reload
73 else
74   /etc/init.d/apache2 reload
75 fi
77 exit 0