File: postinst

package info (click to toggle)
libapache-mod-auth-pam 1.0a-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 96 kB
  • ctags: 28
  • sloc: ansic: 277; sh: 168; makefile: 42
file content (124 lines) | stat: -rw-r--r-- 3,729 bytes parent folder | download
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
set -e

# Automatically added by dh_installdocs
if [ "$1" = "configure" ]; then
        if [ -d /usr/doc -a ! -e /usr/doc/libapache-mod-auth-pam -a -d /usr/share/doc/libapache-mod-auth-pam ]; then
                ln -sf ../share/doc/libapache-mod-auth-pam /usr/doc/libapache-mod-auth-pam
        fi
fi
# End automatically added section
# This function may enable our module.
enable () {
        if
        test -s /etc/apache/httpd.conf
        then
           if grep '^LoadModule.*mod_auth_pam\.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]*) ;;
          *) if [ -x /usr/sbin/apacheconfig ]; then
                /usr/sbin/apacheconfig --force-modules
             fi ;;
        esac
}
#
enablessl () {
           if
           test -s /etc/apache-ssl/httpd.conf 
           then
              if grep '^LoadModule.*mod_auth_pam\.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]*) ;;           
           *) if [ -x /usr/sbin/apache-sslconfig ]; then
                   /usr/sbin/apache-sslconfig --force-modules
              fi;;           
         esac
}         
# Restart apache if user wants.
ask_restart () {
        echo -n "An Apache module has been modified.  Restart apache [Y/n]? "
        read CONFIG
        case "$CONFIG" in
          [nN]*) ;;
          *) /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]*) ;;
          *) /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 test "${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
                test -s /etc/apache/httpd.conf
                 then
                 enable
                fi 
                if
                test -s /etc/apache-ssl/httpd.conf
                 then
                 enablessl
                fi 
      :
    elif test -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 enable the module!
                if
                test -s /etc/apache/httpd.conf
                 then
                 enable
                fi
                if
                test -s /etc/apache-ssl/httpd.conf
                 then
                 enablessl
                fi
      :
    else
      # Version $2 is the most recently configured version of this
      # package.
                if
                test -x /usr/sbin/apachectl
                 then
                 ask_restart
                fi
                if
                 test -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