Code

afa35e520333aba416ddb032e1a8ad7b4842bf43
[pkg-collection4.git] / debian / collection4.postinst
1 #!/bin/sh
2 # postinst script for collection4
3 #
4 # see: dh_installdeb(1)
6 set -e
8 # summary of how this script can be called:
9 #        * <postinst> `configure' <most-recently-configured-version>
10 #        * <old-postinst> `abort-upgrade' <new version>
11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12 #          <new-version>
13 #        * <postinst> `abort-remove'
14 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 #          <failed-install-package> <version> `removing'
16 #          <conflicting-package> <version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
20 . /usr/share/debconf/confmodule
22 configure_apache2() {
23         a2reload="false"
25         if [ -d /etc/apache2/conf.d/ ]; then
26                 if [ ! -e /etc/apache2/conf.d/collection4.conf ]; then
27                         ln -s /etc/collection4/apache.conf /etc/apache2/conf.d/collection4.conf
28                         a2reload="true"
29                 fi
30         fi
32         if [ -d /etc/apache2/mods-enabled ]; then
33                 if [ ! -e /etc/apache2/mods-enabled/fcgid.load -a
34                                 -e /etc/apache2/mods-available/fcgid.load ]; then
35                         a2enmod fcgid
36                         a2reload="true"
37                 else if [ ! -e /etc/apache2/mods-enabled/fastcgi.load -a
38                                 -e /etc/apache2/mods-available/fastcgi.load ]; then
39                         a2enmod fastcgi
40                         a2reload="true"
41                 fi; fi
42         fi
44         if [ "$a2reload" = "true" ]; then
45                 invoke-rc.d apache2 reload
46         fi
47 }
49 case "$1" in
50         configure)
51                 db_get collection4/httpd
52                 http_servers=`echo $RET | sed -e 's/,/ /g'`
54                 for httpd in $http_servers; do
55                         case "$httpd" in
56                                 apache2)
57                                         configure_apache2
58                                         ;;
59                                 # WISHLIST: configure other web servers as well
60                                 *)
61                                         echo "Don't know how to configure web server $httpd" >&2
62                                         ;;
63                         esac
64                 done
65         ;;
67         abort-upgrade|abort-remove|abort-deconfigure)
68         ;;
70         *)
71                 echo "postinst called with unknown argument \`$1'" >&2
72                 exit 1
73         ;;
74 esac
76 # dh_installdeb will replace this with shell code automatically
77 # generated by other debhelper scripts.
79 #DEBHELPER#
81 exit 0