Ukloni nepodrzane direktive NameVirtualHost i SSLMutex jessie debian/2.4.10+2
authorDragan Dosen <Dragan.Dosen@CARNet.hr>
Thu, 6 Oct 2016 13:45:03 +0000 (15:45 +0200)
committerDragan Dosen <Dragan.Dosen@CARNet.hr>
Thu, 6 Oct 2016 13:45:03 +0000 (15:45 +0200)
debian/changelog
debian/postinst

index c8edafd..7509bd6 100644 (file)
@@ -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 <Dragan.Dosen@CARNet.hr>  Thu, 06 Oct 2016 10:51:58 +0200
 
index abc7092..81a0891 100755 (executable)
@@ -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.
 #