File: apache-common.postinst

package info (click to toggle)
apache 1.3.33-6sarge3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,856 kB
  • ctags: 86
  • sloc: sh: 1,229; makefile: 682; perl: 215
file content (62 lines) | stat: -rw-r--r-- 2,160 bytes parent folder | download | duplicates (3)
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
#! /bin/bash

# postinst script for apache-common
#
# see: dh_installdeb(1)

set -e

# The loading of the confmodule is needed for magic tricks in debconf to work
# don't remove :)
. /usr/share/debconf/confmodule
. /usr/share/apache/postinst.common

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

add_group_if_missing
add_user_if_missing

# Fixing mod-bandwith owner/permissions

chown -R www-data:www-data /var/lib/apache/mod-bandwidth
chmod -R 777 /var/lib/apache/mod-bandwidth

# Migrate the FHS-forbidden /var/state/apache directory to
# /var/lib/apache
if [ -d /var/state/apache ]; then
        mv /var/state/apache/mod_bandwidth/* /var/lib/apache/mod_bandwidth/ 2>/dev/null || true
        rmdir /var/state/apache/mod_bandwidth
        rmdir /var/state/apache/

        # It's not FHS, and it's probably our fault this is here,
        # so delete it if we can.
        rmdir /var/state/ 2> /dev/null || true

# Restart *all* apache instances here that might depend on it
        if [ -x /usr/sbin/invoke-rc.d ]; then
            invoke-rc.d apache restart || true
            invoke-rc.d apache-ssl restart || true
            invoke-rc.d apache-perl restart || true
        else
            /etc/init.d/apache restart || true
            /etc/init.d/apache-ssl restart || true
            /etc/init.d/apache-perl restart || true
        fi
fi

#DEBHELPER#