cb6a33cf7794701b69d3b1a504df0c91d4106ef5
[tine20] / scripts / packaging / Univention / debian / tine20-webstack.postinst
1 #!/bin/sh
2 #
3 # Copyright 2012-2012 by Metaways Infosystems GmbH
4 #
5 # http://www.metaways.de/
6 #
7 # All rights reserved.
8 #
9 # The source code of this program is made available
10 # under the terms of the GNU Affero General Public License version 3
11 # (GNU AGPL V3) as published by the Free Software Foundation.
12 #
13 # Binary versions of this program provided by Univention to you as
14 # well as other copyrighted, protected or trademarked materials like
15 # Logos, graphics, fonts, specific documentations and configurations,
16 # cryptographic keys etc. are subject to a license agreement between
17 # you and Univention and not subject to the GNU AGPL V3.
18 #
19 # In the case you use this program under the terms of the GNU AGPL V3,
20 # the program is provided in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU Affero General Public License for more details.
24 #
25 # You should have received a copy of the GNU Affero General Public
26 # License with the Debian GNU/Linux or Univention distribution in file
27 # /usr/share/common-licenses/AGPL-3; if not, see
28 # <http://www.gnu.org/licenses/>.
29
30 #DEBHELPER#
31
32 . /usr/share/debconf/confmodule
33 db_version 2.0
34
35 if [ "$1" = "configure" ]; then
36
37     # setup webserver
38     db_get tine20/webserver_type
39     webserver="$RET"
40     
41     case "$webserver" in
42         apache2)
43             # check if webserver is installed
44             if [ -x /usr/sbin/$webserver ]; then 
45
46                 if [ -d /etc/apache2/mods-enabled ]; then
47                     if [ ! -f /etc/apache2/mods-enabled/rewrite.load -a ! -h /etc/apache2/mods-enabled/rewrite.load ]; then
48                         /usr/sbin/a2enmod rewrite
49                     fi
50                     if [ ! -f /etc/apache2/mods-enabled/expires.load -a ! -h /etc/apache2/mods-enabled/expires.load ]; then
51                         /usr/sbin/a2enmod expires
52                     fi
53                     if [ -f /etc/apache2/mods-available/php5.load ]; then
54                         if [ ! -f /etc/apache2/mods-enabled/php5.load -a ! -h /etc/apache2/mods-enabled/php5.load ]; then
55                             /usr/sbin/a2enmod php5
56                         fi 
57                     fi
58                 fi
59                 
60                 # create Apache 2.x configuration links
61                 if [ -d /etc/apache2/conf.d/ ]; then
62                     if [ ! -e /etc/apache2/conf.d/tine20 ]; then
63                         ln -s ../../tine20/apache.conf /etc/apache2/conf.d/tine20
64                     fi
65                     
66                 elif [ -d /etc/apache2/conf-available ]; then
67                     if [ ! -e /etc/apache2/conf-available/tine20.conf ]; then
68                         ln -s ../../tine20/apache.conf /etc/apache2/conf-available/tine20.conf
69                     fi
70                     
71                     /usr/sbin/a2enconf tine20
72                 fi
73                 
74                 #linkdestination_apache="../../tine20/apache.conf"
75                 #linkname="tine20"
76                 #
77                 #if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
78                 #    . /usr/share/wwwconfig-common/confd-link.sh
79                 #fi
80                 
81                 # mark webserver for restart (used by restart.sh)
82                 servers="apache2"
83                 restart="$restart $webserver"
84             
85             fi
86             ;;
87             
88         lighttpd)
89             # check if webserver is installed
90             if [ -x /usr/sbin/$webserver ]; then 
91
92                 # create vhost configuration links
93                 servers="$webserver"
94                 linkdestination_lighttpd="../../tine20/lighttpd.conf"
95                 linkname="15-tine20.conf"
96     
97                 if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
98                     . /usr/share/wwwconfig-common/confd-link.sh
99                 fi
100                 
101                 if [ -d /etc/$webserver/conf-available ]; then
102                     if [ ! -f /etc/$webserver/conf-enabled/10-expire.conf -a ! -h /etc/$webserver/conf-enabled/10-expire.conf ]; then
103                         /usr/sbin/lighttpd-enable-mod expire
104                     fi
105     
106                     if [ ! -f /etc/$webserver/conf-enabled/15-tine20.conf -a ! -h /etc/$webserver/conf-enabled/15-tine20.conf ]; then
107                         /usr/sbin/lighttpd-enable-mod tine20
108                     fi
109                 fi
110                 
111                 # mark webserver for restart (used by restart.sh)
112                 restart="$restart $webserver"
113             
114             fi
115             ;;
116         
117     esac
118     
119     # restart webserver
120     if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
121         . /usr/share/wwwconfig-common/restart.sh
122     fi
123
124 fi
125
126 exit 0