## Begin - Generated by CARNet package apache2-cn
#
# REMOVE this whole block if you DON'T WANT apache2-cn
-# to edit your configuration file.
+# to edit or undo your changes to this configuration file.
#
## End - Generated by CARNet package apache2-cn
EOF
cp_echo "CN: Doing backup for all files in $dir"
for file in ${dir}/*; do
if [ -f "$file" ]; then
- if [ -z "$(echo $file | egrep '^/.*~')" ]; then
+ if [ -z "$(echo "$file" | egrep '^/.*(~|(\.(old|staro|bkp|bak|swp|tmp|dpkg-.+|cn-.+)))$')" ]; then
backup_dir="$BACKUPDIR/$(basename $(dirname "$file"))"
cp_backup_conffile -d "$backup_dir" -p "$file"
fi
if [ -d "${dir}" ] && [ -n "$(ls -A ${dir}/)" ]; then
mkdir -p "$newdir"
for file in ${dir}/*; do
+ [ -z "$(echo "$file" | egrep '^/.*(~|(\.(old|staro|bkp|bak|swp|tmp|dpkg-.+|cn-.+)))$')" ] || continue
newfile="${newdir}/$(basename "$file" .conf).conf"
if [ ! -e "$newfile" ]; then
cp_echo "CN: Preserving changes to $newfile (renamed from $file)."
if [ -d "${edir}" ] && [ -n "$(ls -A ${edir}/)" ]; then
mkdir -p "$adir"
for efile in ${edir}/*; do
+ [ -z "$(echo "$efile" | egrep '^/.*(~|(\.(old|staro|bkp|bak|swp|tmp|dpkg-.+|cn-.+)))$')" ] || continue
+
[ ! -e "${edir}/$(basename "$efile" .conf).conf" ] || continue
afile="$(readlink -q -m "$efile")"
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.
#
fi
cp_echo "CN: Enabling required Apache2 web server modules."
+ a2enmod -m -q access_compat
a2enmod -m -q cgi
a2enmod -m -q rewrite
a2enmod -m -q userdir
a2enmod -m -q suexec
- a2enmod -m -q php5
+# a2enmod -m -q php5
a2enmod -m -q ssl
fi
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.
#