Code

c5be1424318a1c5d28c3ca5c84625770b6bbcb9d
[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   triggered)
16       /usr/sbin/update-gosa
17       exit 0
18       ;;
20   *)
21       echo "postinst called with unknown argument \`$1'" >&2
22       exit 1
23       ;;
24 esac
26 #DEBHELPER#
28 # Set ID's
29 WEBUSER="www-data"
30 WEBGROUP="www-data"
32 # Create empty inclusion file for apache
33 if [ ! -f /etc/gosa/gosa.secrets ]; then
34     touch /etc/gosa/gosa.secrets
35     chmod 600 /etc/gosa/gosa.secrets
36 fi
38 if [ -d /etc/apache2/conf.d ]; then
40   # Copy GOsa configuration to conf.d directories
41   if [ ! -L /etc/apache2/conf.d/gosa.conf ]; then
43     # Remove old instances of this file
44     if [ -f /etc/apache2/conf.d/gosa.conf ]; then
45       echo "Found old gosa apache configuration in /etc/apache2/conf.d - moving it to gosa.conf.orig..."
46       echo "Please check for changes in /etc/gosa/gosa-apache.conf if you modified this file!"
47       mv /etc/apache2/conf.d/gosa.conf /etc/apache2/conf.d/gosa.conf.orig
48     fi
50     echo "Making /gosa available in /etc/apache2/conf.d"
52     # Add GOsa include file
53     ln -s /etc/gosa/gosa-apache.conf /etc/apache2/conf.d/gosa.conf
54   fi
55   
56   # Add support for RequestHeader
57   a2enmod headers
59   # Finally restart servers
60   if [ -x /usr/sbin/invoke-rc.d ]; then
61     invoke-rc.d apache2 reload
62   else
63     /etc/init.d/apache2 reload
64   fi
65 fi
67 if [ -d /etc/lighttpd/conf-available ]; then
69   # Copy GOsa configuration to conf-available directories /etc/lighttpd/conf-available
70   if [ ! -L /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf ]; then
72     # Remove old instances of this file
73     if [ -f /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf ]; then
74       echo "Found old gosa apache configuration in /etc/lighttpd/conf-enabled - moving it to orig.gosa-lighttpd.conf ..."
75       echo "Please check for changes in /etc/lighttpd/conf-available/orig.99gosa-lighttpd.conf if you modified this file!"
76       mv /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf /etc/lighttpd/conf-available/orig.gosa-lighttpd.conf
77     fi
79     echo "Making /gosa available in /etc/lighttpd/conf-enabled/"
81     # Add GOsa include file
82     ln -s /etc/gosa/gosa-lighttpd.conf /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf
83   fi
85   # Finally restart servers
86   if [ -x /usr/sbin/invoke-rc.d ]; then
87     invoke-rc.d lighttpd reload
88   else
89     /etc/init.d/lighttpd reload
90   fi
92 fi
94 # Add links for safe mode
95 [ ! -d /usr/share/gosa/bin ] && mkdir -p /usr/share/gosa/bin
96 for source in /usr/bin/convert /usr/bin/lpstat; do
97   if [ -e $source ]; then
98     target=/usr/share/gosa/bin/${source##*/}
99     [ ! -L $target ] && ln -sf $source $target
100   fi
101 done
103 # Fix permission in /var/(spool|cache)/gosa
104 chown root.$WEBGROUP -R /var/spool/gosa
105 chmod 770 -R /var/spool/gosa
106 chown root.$WEBGROUP -R /var/cache/gosa
107 chmod 770 -R /var/cache/gosa
109 update-gosa
111 exit 0