This file is indexed.

preinst is in apache2 2.4.7-1ubuntu4.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#! /bin/bash
# preinst script for apache2
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# XXX remove
# echo apache2.preinst $@ running

# XXX: Whichever file you add in one of the sections below, make sure you copy
# the same file arrays to apache2.postinst and apache2.postrm, too!

OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
/etc/apache2/mods-available/authn_default.load
/etc/apache2/mods-available/mem_cache.load
/etc/apache2/mods-available/mem_cache.conf
/etc/apache2/mods-available/authn_alias.load
/etc/apache2/mods-available/cern_meta.load
/etc/apache2/mods-available/disk_cache.load
/etc/apache2/mods-available/disk_cache.conf
/etc/apache2/mods-available/ident.load
/etc/apache2/mods-available/imagemap.load
/etc/apache2/mods-available/version.load"

# conffiles which moved from one random location to another, separate source and
# destination by a colon
MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2
/etc/apache2/sites-available/default:/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-available/default-ssl:/etc/apache2/sites-available/default-ssl.conf
/etc/apache2/conf.d/charset:/etc/apache2/conf-available/charset.conf
/etc/apache2/conf.d/localized-error-pages:/etc/apache2/conf-available/localized-error-pages.conf
/etc/apache2/conf.d/other-vhosts-access-log:/etc/apache2/conf-available/other-vhosts-access-log.conf
/etc/apache2/conf.d/security:/etc/apache2/conf-available/security.conf"


obsolete_conffile_exists()
{
	for CONFFILE in $OBSOLETE_CONFFILES ; do
		if [ -e "$CONFFILE" ] ; then
			return 0
		fi
	done

	for CONFFILE in $MOVED_CONFFILES_IN ; do
		if [ -e "/etc/apache2/conf.d/$CONFFILE" ] ; then
			return 0
		fi
	done

	return 1
}

# The two functions below are licensed GPL-2+ and was written by dpkg maintainers
# See the dpkg-maintscript-helper script for details
prepare_rm_conffile()
{
	for CONFFILE in $OBSOLETE_CONFFILES ; do
		[ -e "$CONFFILE" ] || continue

		local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
		local old_md5sum="$(dpkg-query -W -f='${Conffiles}' apache2.2-common apache2 | \
			sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
		if [ "$md5sum" != "$old_md5sum" ]; then
			echo "Obsolete conffile $CONFFILE has been modified by you."
			echo "Saving as $CONFFILE.dpkg-bak ..."
			mv -f "$CONFFILE" "$CONFFILE.dpkg-backup"
		else
			echo "Moving obsolete conffile $CONFFILE out of the way..."
			mv -f "$CONFFILE" "$CONFFILE.dpkg-remove"
		fi
	done
}

prepare_mv_conffile()
{
	for CONFFILE in $MOVED_CONFFILES ; do

		CONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )

		[ -e "$CONFFILE" ] || continue

		local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
		local old_md5sum="$(dpkg-query -W -f='${Conffiles}' apache2.2-common apache2 | \
			sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"

		if [ "$md5sum" = "$old_md5sum" ]; then
			mv -f "$CONFFILE" "$CONFFILE.dpkg-remove"
		fi
	done
}

case "$1" in
    install|upgrade)

	# black magic follows below. we're upgrading from Squeeze if

	# 1) an apache2-mpm package exists
	if [ -d "/etc/apache2/" ] ; then
	    	mpm=$(dpkg-query -f '${Package}\t${Status}\n'  -W 'apache2-mpm-*' 2>/dev/null | grep "install ok" | cut -f1)
		if [ -n "$mpm" ] ; then
			if [ ! -f /etc/apache2/.apache2_mpm_selected ] ; then
				echo "# automatically created during upgrade" >> /etc/apache2/.apache2_mpm_selected
				echo "# it can be safely removed anytime" >> /etc/apache2/.apache2_mpm_selected
				echo "$mpm" >> /etc/apache2/.apache2_mpm_selected
			fi
		fi

		if [ -n "$2" ] && dpkg --compare-versions "$2" 'lt' '2.4.7-1~' && dpkg --compare-versions "$2" 'ge' '2.4.1-1' ; then
			CUR_MPM=$(a2query -M) || exit 1
			if [ "$CUR_MPM" == "itk" ] ; then
				echo "apache2-mpm-itk" >> /etc/apache2/.apache2_mpm_selected
			fi
		fi
	fi
	# 2) an apache2.2-common conffiles exists or the 2.2 apache2 package is
	# installed
	if [ -n "$2" ] || obsolete_conffile_exists ; then
		prepare_rm_conffile
		prepare_mv_conffile
	fi

    ;;

    abort-upgrade)
    ;;

    *)
	echo "preinst called with unknown argument \`$1'" >&2
	exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0

# vim: syntax=sh ts=4 sw=4 sts=4 sr noet