d6f05592ae8d25f4584a2e2796ff81604020a15a
[tine20] / scripts / packaging / 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 vhost configuration links
61                 servers="apache2"
62                 linkdestination_apache="../../tine20/apache.conf"
63                 linkname="tine20"
64     
65                 if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
66                     . /usr/share/wwwconfig-common/confd-link.sh
67                 fi
68                 
69                 # mark webserver for restart (used by restart.sh)
70                 restart="$restart $webserver"
71             
72             fi
73             ;;
74             
75         lighttpd)
76             # check if webserver is installed
77             if [ -x /usr/sbin/$webserver ]; then 
78
79                 # create vhost configuration links
80                 servers="$webserver"
81                 linkdestination_lighttpd="../../tine20/lighttpd.conf"
82                 linkname="15-tine20.conf"
83     
84                 if [ -e /usr/share/wwwconfig-common/confd-link.sh ]; then
85                     . /usr/share/wwwconfig-common/confd-link.sh
86                 fi
87                 
88                 if [ -d /etc/$webserver/conf-available ]; then
89                     if [ ! -f /etc/$webserver/conf-enabled/10-expire.conf -a ! -h /etc/$webserver/conf-enabled/10-expire.conf ]; then
90                         /usr/sbin/lighttpd-enable-mod expire
91                     fi
92     
93                     if [ ! -f /etc/$webserver/conf-enabled/15-tine20.conf -a ! -h /etc/$webserver/conf-enabled/15-tine20.conf ]; then
94                         /usr/sbin/lighttpd-enable-mod tine20
95                     fi
96                 fi
97                 
98                 # mark webserver for restart (used by restart.sh)
99                 restart="$restart $webserver"
100             
101             fi
102             ;;
103         
104     esac
105     
106     # restart webserver
107     if [ -e /usr/share/wwwconfig-common/restart.sh ]; then
108         . /usr/share/wwwconfig-common/restart.sh
109     fi
110
111 fi
112
113 exit 0