Added Debian build files, based on 2.4.0-2 mod_fastcgi package from Debian unstable
[mod_fastcgi.git] / debian / postinst
blobb586c55896a47be79c6e44f4ffd7858a3298daa4
1 #!/bin/bash
2 # vim: set ts=2 sw=2 et:
4 set -e
6 # These functions ask the user whether to reconfigure apache/apachessl.
7 do_enable () {
8 if [ -s /etc/apache/httpd.conf ] ; then
9 if grep '^LoadModule.*mod_fastcgi\.so' /etc/apache/httpd.conf 2>&1 >/dev/null
10 then
11 exit 0
14 echo -n "A new Apache module has been installed. Reconfigure apache [Y/n]? "
15 read CONFIG
16 case "$CONFIG" in
17 [nN]*) # user said no
18 echo -n "" # do nothing
20 *) # user said yes
21 if [ -x /usr/sbin/apacheconfig ] ; then
22 /usr/sbin/apacheconfig --force-modules
25 esac
28 do_enablessl () {
29 if [ -s /etc/apache-ssl/httpd.conf ] ; then
30 if grep '^LoadModule.*mod_fastcgi\.so' /etc/apache-ssl/httpd.conf 2>&1 >/dev/null ; then
31 exit 0
34 echo -n "A new Apache module has been installed. Reconfigure apache-ssl [Y/n]? "
35 read CONFIG
36 case "$CONFIG" in
37 [nN]*) # user said no
38 echo -n "" # do nothing
40 *) # user said yes
41 if [ -x /usr/sbin/apache-sslconfig ] ; then
42 /usr/sbin/apache-sslconfig --force-modules
45 esac
48 # These functions ask the user whether to restart apache/apachessl.
49 ask_restart () {
50 echo -n "An Apache module has been modified. Restart apache [Y/n]? "
51 read CONFIG
52 case "$CONFIG" in
53 [nN]*) # user said no
54 echo -n "" # do nothing
56 *) # user said yes
57 /usr/sbin/apachectl restart
59 esac
61 ask_restartssl () {
62 echo -n "An Apache module has been modified. Restart apache-ssl [Y/n]? "
63 read CONFIG
64 case "$CONFIG" in
65 [nN]*) # user said no
66 echo -n "" # do nothing
68 *) # user said yes
69 /usr/sbin/apache-sslctl restart
71 esac
74 case "$1" in
75 configure)
76 # Configure this package. If the package must prompt the user for
77 # information, do it here. There are three sub-cases.
78 if [ "${2+set}" != "set" ] ; then
79 # We're being installed by an ancient dpkg which doesn't remember
80 # which version was most recently configured, or even whether
81 # there is a most recently configured version.
82 if [ -s /etc/apache/httpd.conf ] ; then do_enable ; fi
83 if [ -s /etc/apache-ssl/httpd.conf ] ; then do_enablessl ; fi
84 elif [ -z "$2" -o "$2" = "<unknown>" ] ; then
85 # The package has not ever been configured on this system, or was
86 # purged since it was last configured.
87 # DJ: So let's do_enable the module!
88 if [ -s /etc/apache/httpd.conf ] ; then do_enable ; fi
89 if [ -s /etc/apache-ssl/httpd.conf ] ; then do_enablessl ; fi
90 else
91 # Version $2 is the most recently configured version of this
92 # package.
93 if [ -x /usr/sbin/apachectl ] ; then ask_restart ; fi
94 if [ -x /usr/sbin/apache-sslctl ] ; then ask_restartssl ; fi
97 abort-upgrade | abort-remove | abort-deconfigure)
100 echo "$0: didn't understand being called with \`$1'" 1>&2
101 exit 1
103 esac
105 exit 0
107 #DEBHELPER#