From 6bb8372a1ec85a96115db296863737f1cf709241 Mon Sep 17 00:00:00 2001 From: Dragan Dosen Date: Thu, 6 Oct 2016 15:45:03 +0200 Subject: [PATCH] Ukloni nepodrzane direktive NameVirtualHost i SSLMutex --- debian/changelog | 4 +++- debian/postinst | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index c8edafd..7509bd6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -apache2-cn (2.4.10+2) UNRELEASED; urgency=low +apache2-cn (2.4.10+2) stable; urgency=low * Azuriran tekst koji se dodaje u generirane konfiguracijske datoteke. * Koristi Require u predloscima, umjesto Order i Allow direktiva. @@ -6,6 +6,8 @@ apache2-cn (2.4.10+2) UNRELEASED; urgency=low * Aktivacija modula access_compat. * Ignoriranje datoteka ciji nazivi zavrsavaju s ~, .old, .staro, .bkp, .bak, .swp, .tmp, .dpkg-* i .cn-*. + * Ukloni direktive koje vise nisu podrzane, NameVirtualHost i SSLMutex. + * Dodaj default Mutex ako nije naveden u /etc/apache2/apache2.conf. -- Dragan Dosen Thu, 06 Oct 2016 10:51:58 +0200 diff --git a/debian/postinst b/debian/postinst index abc7092..81a0891 100755 --- a/debian/postinst +++ b/debian/postinst @@ -395,6 +395,25 @@ rename_conf () { fi } +# listconffiles() +# +# Recursively walks /etc/apache2/apache2.conf for Include and +# IncludeOptional directives. +# Prints all configfiles so defined. +# +listconffiles () { + local i incs + local base_dir="`dirname $1`" + + incs=`awk 'tolower($1) ~ /include(optional)?/ { sub("/$","/*",$2); print $2; }' $1` + incs=`echo "$incs" | sed -r "s#^([^/])#${base_dir}/\1#"` + if [ -n "$incs" ]; then + for i in $incs; do + if [ -e "$i" ]; then echo "`readlink -m -q $i`"; listconffiles "$i"; fi + done + fi +} + # Set trap for deleting all temp files. # @@ -480,6 +499,43 @@ if [ -e "$CONF" ]; then rm -f "$CONFTMP" fi +# Remove deprecated directives. Add default Mutex if not defined. +# +if [ -e "$CONF" ]; then + + ( listconffiles "$CONF"; echo "$CONF" ) | while read -r a2cfile; do + + a2cfiletmp=`mktemp $a2cfile.tmp.XXXXXX` + temp_files="${temp_files} ${a2cfiletmp}" + cp "$a2cfile" "$a2cfiletmp" + + if egrep -iq "^[[:space:]]*NameVirtualHost[[:space:]]+" "$a2cfiletmp"; then + cp_echo "CN: Removing deprecated NameVirtualHost from $a2cfile" + sed -r -i '/^[[:space:]]*NameVirtualHost[[:space:]]+/Id' \ + "$a2cfiletmp" + fi + + if egrep -iq "^[[:space:]]*SSLMutex[[:space:]]+" "$a2cfiletmp"; then + cp_echo "CN: Removing deprecated SSLMutex from $a2cfile" + sed -r -i '/^[[:space:]]*SSLMutex[[:space:]]+/Id' \ + "$a2cfiletmp" + fi + + if [ "$a2cfile" = "$CONF" ]; then + if ! egrep -iq "^[[:space:]]*Mutex[[:space:]]+" "$a2cfiletmp"; then + cp_echo "CN: Adding default Mutex to $a2cfile" + echo 'Mutex file:${APACHE_LOCK_DIR} default' >> "$a2cfiletmp" + fi + fi + + if ! cmp -s "$a2cfiletmp" "$a2cfile"; then + cp_mv "$a2cfiletmp" "$a2cfile" + need_restart=1 + fi + rm -f "$a2cfiletmp" + done +fi + # Install CARNet specific configuration file. # -- 1.7.10.4