-# Check Apache2 web server configuration and reload Apache2 web server.
-#
-if apache2ctl configtest 2>/dev/null; then
- invoke-rc.d apache2 force-reload || true
+ rm -f $oldconffile.dpkg-remove
+ [ -e "$oldconffile" ] || return 0
+
+ cp_echo "CN: Preserving user changes to $newconffile (renamed from $oldconffile)."
+ mv -f "$newconffile" "$newconffile.dpkg-new"
+ mv -f "$oldconffile" "$newconffile"
+}
+
+
+mv_conffile /etc/apache2/conf.d/$PKG.conf /etc/apache2/conf-available/$PKG.conf
+
+if [ -f "$WCONF" ]; then
+ # Backup first.
+ if cp_check_and_backup "$WCONF"; then
+ cp_echo "CN: Old $WCONF saved as /var/backups/$WCONFBAK.bak."
+ fi
+
+ # Check for OutputDir
+ temp=`awk 'tolower($1) == "outputdir" { print $2; }' $WCONF | tail -n 1`
+ if [ "$temp" != "$WDIR" ]; then
+ cp_echo "CN: Found custom OutputDir value: $temp"
+ db_set webalizer/directory "$temp" || true
+ customized=1
+ fi
+
+ # Check for ReportTitle
+ temp=`awk 'tolower($1) == "reporttitle" { for(i=2; i<NF; i++) \
+ printf("%s ", tolower($i)); print tolower($(NF)) }' $WCONF | tail -n 1`
+ if [ "$temp" = "$oldreporttitle" ]; then
+ temp_re="^[[:space:]]*ReportTitle[[:space:]]*${oldreporttitle}$"
+ cp_check_and_sed "." \
+ "s/$temp_re/ReportTitle ${reporttitle}/I" \
+ "$WCONF" || true
+ db_set webalizer/doc_title "$reporttitle" || true
+ fi