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

« back to all changes in this revision

Viewing changes to debian/apache2-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
 
# Source Debconf confmodule.
8
 
#. /usr/share/debconf/confmodule
9
 
 
10
 
NETSTAT=netstat
11
 
 
12
 
# An ugly hack, I know, but a necessarily ugly hack.
13
 
#This desperately needs debconf, soon.
14
 
if [ ! -f /etc/apache2/ports.conf ]; then
15
 
        echo "# 0 = start on boot; 1 = don't start on boot" > /etc/default/apache2
16
 
        NO_AF_INET=`$NETSTAT -lnt 2>&1 | grep 'no support for .AF INET (tcp)'` || true
17
 
        NO_PORT_80=`$NETSTAT -lnt | awk '{print $4}' | grep ':80$'` || true
18
 
        if [ -n "$NO_AF_INET" -o -n "$NO_PORT_80" ]; then
19
 
                echo "NO_START=1" >> /etc/default/apache2
20
 
                echo "Listen 80" >> /etc/apache2/ports.conf
21
 
                if [ -n "$NO_AF_INET" ]; then
22
 
                        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."
23
 
                fi
24
 
                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."
25
 
        else
26
 
                echo "NO_START=0" >> /etc/default/apache2
27
 
                echo "Listen 80" >> /etc/apache2/ports.conf
28
 
                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."
29
 
        fi
30
 
fi
31
 
 
32
 
# check for 2.2 kernels and set up the scoreboard.
33
 
if [ `uname -r|grep "^2.2"` ]; then
34
 
        printf "#This is required for 2.2 kernels\nScoreboardFile /var/log/apache2/apache2_scoreboard\n" > /etc/apache2/conf.d/scoreboard
35
 
fi
36
 
 
37
 
# Make self-signed certificate
38
 
#if [ ! -f /etc/apache2/ssl/apache.pem ]
39
 
#then
40
 
#        /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
41
 
#fi
42
 
 
43
 
#create httpd.conf
44
 
if [ ! -e /etc/apache2/httpd.conf ]; then
45
 
cat >/etc/apache2/httpd.conf <<EOF
46
 
# This is here for backwards compatability reasons and to support
47
 
#  installing 3rd party modules directly via apxs2, rather than
48
 
#  through the /etc/apache2/mods-{available,enabled} mechanism.
49
 
#
50
 
#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so
51
 
EOF
52
 
fi
53
 
 
54
 
#set up default site and dummy error and access logs
55
 
if [ "$2" = "<unknown>" -o -z "$2" ]; then
56
 
        if [ ! -L /etc/apache2/sites-enabled/000-default -a \
57
 
             ! -f /etc/apache2/sites-enabled/000-default ]; then 
58
 
                ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/000-default
59
 
        fi
60
 
        touch /var/log/apache2/error.log /var/log/apache2/access.log
61
 
        chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
62
 
        chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log 
63
 
        if [ ! -f /etc/apache2/conf.d/charset ]; then
64
 
                echo "AddDefaultCharset UTF-8" > /etc/apache2/conf.d/charset
65
 
        fi
66
 
fi
67
 
 
68
 
#auto enable mod_userdir on upgrades and new installs, otherwise things will B-R-EAK
69
 
if dpkg --compare-versions "$2" lt 2.0.50-1; then
70
 
        a2enmod userdir
71
 
fi
72
 
 
73
 
exit 0