~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to debian/apache2.2-common.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
if [ "$1" != "configure" ]; then
 
4
        exit 0
 
5
fi
 
6
 
 
7
NETSTAT=netstat
 
8
 
 
9
if [ -e /usr/sbin/apache2 ]; then
 
10
    if [ "`dpkg-statoverride --list /usr/sbin/apache2`" = "" ]; then
 
11
        chmod +x /usr/sbin/apache2
 
12
    else
 
13
        chmod `dpkg-statoverride --list /usr/sbin/apache2 | cut -f 3` /usr/sbin/apache2
 
14
    fi
 
15
fi
 
16
 
 
17
if [ ! -f /etc/apache2/ports.conf ]; then
 
18
        echo "# 0 = start on boot; 1 = don't start on boot" > /etc/default/apache2
 
19
        NO_AF_INET=`$NETSTAT -lnt 2>&1 | grep 'no support for .AF INET (tcp)'` || true
 
20
        NO_PORT_80=`$NETSTAT -lnt | awk '{print $4}' | grep ':80$'` || true
 
21
        if [ -n "$NO_AF_INET" -o -n "$NO_PORT_80" ]; then
 
22
                echo "NO_START=1" >> /etc/default/apache2
 
23
                echo "Listen 80" >> /etc/apache2/ports.conf
 
24
                if [ -n "$NO_AF_INET" ]; then
 
25
                        echo "netstat is unable to query the state of your listening TCP ports.  This could be because you don't have TCP support in your kernel (unlikely), or because you do not have the /proc filesystem mounted.  To be on the safe side, we're assuming that port 80 is in use."
 
26
                fi
 
27
                echo "Setting Apache2 not to start, as something else appears to be using Port 80. To allow apache2 to start, set NO_START to 0 in /etc/default/apache2. Apache2 has been set to listen on port 80 by default, so please edit /etc/apache2/ports.conf as desired. Note that the Port directive no longer works."
 
28
        else
 
29
                echo "NO_START=0" >> /etc/default/apache2
 
30
                echo "Listen 80" >> /etc/apache2/ports.conf
 
31
                echo "Setting Apache2 to Listen on port 80. If this is not desired, please edit /etc/apache2/ports.conf as desired. Note that the Port directive no longer works."
 
32
        fi
 
33
fi
 
34
 
 
35
 
 
36
#set up default site and dummy error and access logs
 
37
if [ "$2" = "<unknown>" -o -z "$2" ]; then
 
38
        if [ ! -L /etc/apache2/sites-enabled/000-default -a \
 
39
             ! -f /etc/apache2/sites-enabled/000-default ]; then
 
40
                ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/000-default
 
41
        fi
 
42
        touch /var/log/apache2/error.log /var/log/apache2/access.log
 
43
        chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
 
44
        chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log
 
45
        if [ ! -f /etc/apache2/conf.d/charset ]; then
 
46
                echo "AddDefaultCharset UTF-8" > /etc/apache2/conf.d/charset
 
47
        fi
 
48
fi
 
49
 
 
50
if [ "$2" = "<unknown>" -o -z "$2" ] || dpkg --compare-versions "$2" lt 2.2.3-3.1; then
 
51
        a2enmod alias
 
52
        a2enmod autoindex
 
53
        a2enmod dir
 
54
        a2enmod env
 
55
        a2enmod mime
 
56
        a2enmod negotiation
 
57
        a2enmod setenvif
 
58
        a2enmod status
 
59
        a2enmod auth_basic
 
60
 
 
61
        # Those come from mod_auth:
 
62
        a2enmod authz_default
 
63
        a2enmod authz_user
 
64
        a2enmod authz_groupfile
 
65
        a2enmod authn_file
 
66
        
 
67
        # This comes from mod_access:
 
68
        a2enmod authz_host
 
69
 
 
70
        # Module replacements from previous versions of apache2
 
71
        if [ -L /etc/apache2/mods-enabled/imap.load ]; then
 
72
                a2dismod imap
 
73
                a2enmod imagemap
 
74
        fi
 
75
        if [ -L /etc/apache2/mods-enabled/auth_ldap.load ]; then
 
76
                a2dismod auth_ldap
 
77
                a2enmod authnz_ldap
 
78
        fi
 
79
fi
 
80
 
 
81
# Make sure /var/lock/apache2 has the correct permissions
 
82
if [ -d /var/lock/apache2 ]; then
 
83
        chown www-data /var/lock/apache2
 
84
fi
 
85
 
 
86
exit 0