edf307e373202935846a278f47bff367477f5861
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 ;;
19 *)
20 echo "postinst called with unknown argument \`$1'" >&2
21 exit 1
22 ;;
23 esac
25 #DEBHELPER#
27 # Set ID's
28 WEBUSER="www-data"
29 WEBGROUP="www-data"
31 # Create empty inclusion file for apache
32 if [ ! -f /etc/gosa/gosa.secrets ]; then
33 touch /etc/gosa/gosa.secrets
34 chmod 600 /etc/gosa/gosa.secrets
35 fi
37 if [ -d /etc/apache2/conf.d ]; then
39 # Copy GOsa configuration to conf.d directories
40 if [ ! -L /etc/apache2/conf.d/gosa.conf ]; then
42 # Remove old instances of this file
43 if [ -f /etc/apache2/conf.d/gosa.conf ]; then
44 echo "Found old gosa apache configuration in /etc/apache2/conf.d - moving it to gosa.conf.orig..."
45 echo "Please check for changes in /etc/gosa/gosa-apache.conf if you modified this file!"
46 mv /etc/apache2/conf.d/gosa.conf /etc/apache2/conf.d/gosa.conf.orig
47 fi
49 echo "Making /gosa available in /etc/apache2/conf.d"
51 # Add GOsa include file
52 ln -s /etc/gosa/gosa-apache.conf /etc/apache2/conf.d/gosa.conf
53 fi
55 # Add support for RequestHeader
56 a2enmod headers
58 # Finally restart servers
59 if [ -x /usr/sbin/invoke-rc.d ]; then
60 invoke-rc.d apache2 reload
61 else
62 /etc/init.d/apache2 reload
63 fi
64 fi
66 if [ -d /etc/lighttpd/conf-available ]; then
68 # Copy GOsa configuration to conf-available directories /etc/lighttpd/conf-available
69 if [ ! -L /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf ]; then
71 # Remove old instances of this file
72 if [ -f /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf ]; then
73 echo "Found old gosa apache configuration in /etc/lighttpd/conf-enabled - moving it to orig.gosa-lighttpd.conf ..."
74 echo "Please check for changes in /etc/lighttpd/conf-available/orig.99gosa-lighttpd.conf if you modified this file!"
75 mv /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf /etc/lighttpd/conf-available/orig.gosa-lighttpd.conf
76 fi
78 echo "Making /gosa available in /etc/lighttpd/conf-enabled/"
80 # Add GOsa include file
81 ln -s /etc/gosa/gosa-lighttpd.conf /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf
82 fi
84 # Finally restart servers
85 if [ -x /usr/sbin/invoke-rc.d ]; then
86 invoke-rc.d lighttpd reload
87 else
88 /etc/init.d/lighttpd reload
89 fi
91 fi
93 # Add links for safe mode
94 [ ! -d /usr/share/gosa/bin ] && mkdir -p /usr/share/gosa/bin
95 for source in /usr/bin/convert /usr/bin/lpstat; do
96 if [ -e $source ]; then
97 target=/usr/share/gosa/bin/${source##*/}
98 [ ! -L $target ] && ln -sf $source $target
99 fi
100 done
102 # Fix permission in /var/(spool|cache)/gosa
103 chown root.$WEBGROUP -R /var/spool/gosa
104 chmod 770 -R /var/spool/gosa
105 chown root.$WEBGROUP -R /var/cache/gosa
106 chmod 770 -R /var/cache/gosa
108 update-gosa
110 exit 0