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 if [ -d /etc/apache2/conf.d ]; then
35 # Copy GOsa configuration to conf.d directories
36 if [ ! -L /etc/apache2/conf.d/gosa.conf ]; then
38 # Remove old instances of this file
39 if [ -f /etc/apache2/conf.d/gosa.conf ]; then
40 echo "Found old gosa apache configuration in /etc/apache2/conf.d - moving it to gosa.conf.orig..."
41 echo "Please check for changes in /etc/gosa/gosa-apache.conf if you modified this file!"
42 mv /etc/apache2/conf.d/gosa.conf /etc/apache2/conf.d/gosa.conf.orig
43 fi
45 echo "Making /gosa available in /etc/apache2/conf.d"
47 # Add GOsa include file
48 ln -s /etc/gosa/gosa-apache.conf /etc/apache2/conf.d/gosa.conf
49 fi
51 # Add support for RequestHeader
52 a2enmod headers
54 # Finally restart servers
55 if [ -x /usr/sbin/invoke-rc.d ]; then
56 invoke-rc.d apache2 reload
57 else
58 /etc/init.d/apache2 reload
59 fi
60 fi
62 if [ -d /etc/lighttpd/conf-available ]; then
64 # Copy GOsa configuration to conf-available directories /etc/lighttpd/conf-available
65 if [ ! -L /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf ]; then
67 # Remove old instances of this file
68 if [ -f /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf ]; then
69 echo "Found old gosa apache configuration in /etc/lighttpd/conf-enabled - moving it to orig.gosa-lighttpd.conf ..."
70 echo "Please check for changes in /etc/lighttpd/conf-available/orig.99gosa-lighttpd.conf if you modified this file!"
71 mv /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf /etc/lighttpd/conf-available/orig.gosa-lighttpd.conf
72 fi
74 echo "Making /gosa available in /etc/lighttpd/conf-enabled/"
76 # Add GOsa include file
77 ln -s /etc/gosa/gosa-lighttpd.conf /etc/lighttpd/conf-enabled/99gosa-lighttpd.conf
78 fi
80 # Finally restart servers
81 if [ -x /usr/sbin/invoke-rc.d ]; then
82 invoke-rc.d lighttpd reload
83 else
84 /etc/init.d/lighttpd reload
85 fi
87 fi
89 # Add links for safe mode
90 [ ! -d /usr/share/gosa/bin ] && mkdir -p /usr/share/gosa/bin
91 for source in /usr/bin/convert /usr/bin/lpstat; do
92 if [ -e $source ]; then
93 target=/usr/share/gosa/bin/${source##*/}
94 [ ! -L $target ] && ln -sf $source $target
95 fi
96 done
98 # Fix permission in /var/(spool|cache)/gosa
99 chown root.$WEBGROUP -R /var/spool/gosa
100 chmod 770 -R /var/spool/gosa
101 chown root.$WEBGROUP -R /var/cache/gosa
102 chmod 770 -R /var/cache/gosa
104 update-gosa
106 exit 0