File: apache2.2-common.preinst

package info (click to toggle)
apache2 2.2.9-10%2Blenny12
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 37,556 kB
  • ctags: 20,182
  • sloc: ansic: 221,847; sh: 20,216; perl: 2,094; makefile: 1,251; awk: 1,124; pascal: 513; lex: 191; python: 136; yacc: 100
file content (40 lines) | stat: -rw-r--r-- 1,232 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
#! /bin/sh -e

# This is an evil hack around the fact that dpkg is unpacking in the
# wrong order causing "stop" to fail.

if [ -z "$2" ] && [ -e /usr/sbin/apache2 ]; then
    if [ -x "/etc/init.d/apache2" ]; then
        if [ -x /usr/sbin/invoke-rc.d ]; then
                invoke-rc.d apache2 stop || true
        else
                /etc/init.d/apache2 stop || true
        fi
    fi
    chmod -x /usr/sbin/apache2
fi

# YAY, MORE EVILNESS
rm -f /var/lib/dpkg/info/apache2-common.postrm

mv_conffile() {
	if [ "`md5sum $1 2>/dev/null | cut -d ' ' -f 1`" = "$2" ] ; then
		echo Replacing $1 with new version ...
		mv $1 $1.dpkg-apache2.2-common.old
	fi
}

# we want to check in postinst whether /etc/apache2/ports.conf existed before
# the install
if [ -z "$2" ] && [ -e /etc/apache2/ports.conf ]; then
	touch /etc/apache2/ports.conf.dpkg-apache2.2-common.existed
fi

if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.2.4-2; then
	mv_conffile /etc/default/apache2 	9ac83f9132b78c3aa6dd4d7a583bf476
	mv_conffile /etc/default/apache2 	801eb5156368b54d92ecb578ce710836
	mv_conffile /etc/apache2/ports.conf	d5fcefc335117f400d451de47efeca87
	mv_conffile /etc/apache2/conf.d/charset 641239a7d2d172856cb1413a47d2e142
fi

#DEBHELPER#