File: postinst

package info (click to toggle)
libapache-mod-fastcgi 2.4.6-1
  • links: PTS
  • area: non-free
  • in suites: lenny, squeeze
  • size: 568 kB
  • ctags: 600
  • sloc: ansic: 6,287; sh: 334; makefile: 30
file content (107 lines) | stat: -rw-r--r-- 3,043 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# vim: set ts=2 sw=2 et:

set -e

# These functions ask the user whether to reconfigure apache/apachessl.
do_enable () {
  if [ -s /etc/apache/httpd.conf ] ; then
    if grep '^LoadModule.*mod_fastcgi\.so' /etc/apache/httpd.conf 2>&1 >/dev/null
    then
      exit 0
    fi
  fi
  echo -n "A new Apache module has been installed.  Reconfigure apache [Y/n]? "
  read CONFIG
  case "$CONFIG" in
    [nN]*) # user said no
      echo -n ""  # do nothing
      ;;
    *)     # user said yes
      if [ -x /usr/sbin/apacheconfig ] ; then
        /usr/sbin/apacheconfig --force-modules
      fi
      ;;
  esac
}

do_enablessl () {
  if [ -s /etc/apache-ssl/httpd.conf ] ; then
    if grep '^LoadModule.*mod_fastcgi\.so' /etc/apache-ssl/httpd.conf 2>&1 >/dev/null ; then
      exit 0
    fi
  fi
  echo -n "A new Apache module has been installed.  Reconfigure apache-ssl [Y/n]? "
  read CONFIG
  case "$CONFIG" in
    [nN]*)  # user said no
      echo -n ""  # do nothing
      ;;
    *)      # user said yes
      if [ -x /usr/sbin/apache-sslconfig ] ; then
        /usr/sbin/apache-sslconfig --force-modules
      fi
      ;;
  esac
}

# These functions ask the user whether to restart apache/apachessl.
ask_restart () {
  echo -n "An Apache module has been modified.  Restart apache [Y/n]? "
  read CONFIG
  case "$CONFIG" in
    [nN]*)  # user said no
      echo -n ""  # do nothing
      ;;
    *)      # user said yes
      /usr/sbin/apachectl restart
      ;;
  esac
}
ask_restartssl () {
  echo -n "An Apache module has been modified.  Restart apache-ssl [Y/n]? "
  read CONFIG
  case "$CONFIG" in
    [nN]*)  # user said no
      echo -n ""  # do nothing
      ;;
    *)      # user said yes
      /usr/sbin/apache-sslctl restart
      ;;
  esac
}

case "$1" in
  configure)
    # Configure this package.  If the package must prompt the user for
    # information, do it here.  There are three sub-cases.
    if [ "${2+set}" != "set" ] ; then
      # We're being installed by an ancient dpkg which doesn't remember
      # which version was most recently configured, or even whether
      # there is a most recently configured version.
      if [ -s /etc/apache/httpd.conf ]     ; then do_enable    ; fi
      if [ -s /etc/apache-ssl/httpd.conf ] ; then do_enablessl ; fi
    elif [ -z "$2" -o "$2" = "<unknown>" ] ; then
      # The package has not ever been configured on this system, or was
      # purged since it was last configured.
      # DJ: So let's do_enable the module!
      if [ -s /etc/apache/httpd.conf ]     ; then do_enable    ; fi
      if [ -s /etc/apache-ssl/httpd.conf ] ; then do_enablessl ; fi
    else
      # Version $2 is the most recently configured version of this
      # package.
      if [ -x /usr/sbin/apachectl     ] ; then ask_restart    ; fi
      if [ -x /usr/sbin/apache-sslctl ] ; then ask_restartssl ; fi
    fi
    ;;
  abort-upgrade | abort-remove | abort-deconfigure)
    ;;
  *)
    echo "$0: didn't understand being called with \`$1'" 1>&2
    exit 1
    ;;
esac

exit 0

#DEBHELPER#