summaryrefslogtreecommitdiffstats
path: root/debian/apache2.preinst.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 19:09:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 19:09:23 +0000
commit1b631c75a166e0258aad972d74af929b7968ea66 (patch)
treeb5735fd08977a7f74bb1753a6952caeeb1fb73f6 /debian/apache2.preinst.in
parentAdding upstream version 2.4.58. (diff)
downloadapache2-1b631c75a166e0258aad972d74af929b7968ea66.tar.xz
apache2-1b631c75a166e0258aad972d74af929b7968ea66.zip
Adding debian version 2.4.58-1.debian/2.4.58-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/apache2.preinst.in')
-rw-r--r--debian/apache2.preinst.in111
1 files changed, 111 insertions, 0 deletions
diff --git a/debian/apache2.preinst.in b/debian/apache2.preinst.in
new file mode 100644
index 0000000..ebd9fe5
--- /dev/null
+++ b/debian/apache2.preinst.in
@@ -0,0 +1,111 @@
+#! /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
+
+FIXUP_TEMPFILE=
+
+
+# During the migration of conffiles from apache2.2-common to apache2,
+# some things may have gone wrong.
+# * Some conffiles may have been left with obsolete content. These
+# have an md5sum in this list.
+# * Some other conffiles may have been removed but dpkg still thinks that
+# they belong to apache2.2-common. A few of these have been re-introduced,
+# but dpkg being confused about their state causes dpkg to think the
+# admin has removed them and to not create the new content.
+# These have a 'restore' instead of a md5 in the list.
+list_fixup_conffiles () {
+ cat <<- EOF
+ /etc/bash_completion.d/apache2 6a5f85e62655f6b5c8fa0f95c7c35c9c removed
+ /etc/apache2/sites-available/000-default.conf 2cc450cf300a880abbc3767fc002477d
+ /etc/apache2/sites-available/default-ssl.conf 196d150beeaeaf845ece50d7e84e12de
+ /etc/apache2/conf-available/charset.conf e6fbb8adf631932851d6cc522c1e48d7
+ /etc/apache2/conf-available/localized-error-pages.conf 844ba27ddb794fc6967bfb56b950e6a8
+ /etc/apache2/conf-available/other-vhosts-access-log.conf 2cad303fc4221d6b0068a8b37597b9fb
+ /etc/apache2/conf-available/security.conf 0f644d9d04ad556f44f1e65674bc07dc
+ /etc/apache2/mods-available/cern_meta.load restore
+ /etc/apache2/mods-available/ident.load restore
+ /etc/apache2/mods-available/imagemap.load restore
+ EOF
+}
+
+create_fixup_conffiles_tgz () {
+ FIXUP_TEMPFILE=$(mktemp)
+ base64 -d > $FIXUP_TEMPFILE << EOF
+XXX_FIXUP_CONFFILES_BASE64_XXX
+EOF
+}
+
+extract_fixup_conffile () {
+ local FILE=$1
+ local BASENAME=${FILE##*/}
+ tar -xz -O -f $FIXUP_TEMPFILE $BASENAME > $FILE
+}
+
+replace_broken_conffiles () {
+ local FILE
+ local MD5
+ create_fixup_conffiles_tgz
+ while read FILE MD5 REMOVED ; do
+ if [ -f "$FILE" ] && md5sum "$FILE" | grep -q "^$MD5 " ; then
+ echo "Replacing broken conffile ${FILE}."
+ mv "$FILE" "${FILE}.dpkg-remove-fixup"
+ if [ -z "$REMOVED" ] ; then
+ extract_fixup_conffile "$FILE"
+ fi
+ elif [ ! -e "$FILE" ] && [ "$MD5" = "restore" ] ; then
+ echo "Restoring lost conffile ${FILE}."
+ extract_fixup_conffile "$FILE"
+ fi
+ done
+ rm -f "$FIXUP_TEMPFILE"
+}
+
+revert_broken_conffiles () {
+ local FILE
+ local MD5
+ local REMOVE
+ while read FILE MD5 REMOVED; do
+ if [ -f "$FILE.dpkg-remove-fixup" ]; then
+ echo "Moving broken conffile $FILE back."
+ mv "${FILE}.dpkg-remove-fixup" "$FILE"
+ fi
+ done
+}
+
+case "$1" in
+ upgrade|install)
+
+ if dpkg --compare-versions "$2" lt-nl "2.4.23-3~" ; then
+ list_fixup_conffiles | replace_broken_conffiles
+ fi
+
+ ;;
+
+ abort-upgrade)
+ list_fixup_conffiles | revert_broken_conffiles
+ ;;
+
+ *)
+ 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.
+
+#DEBHELPER#
+
+exit 0