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