+%triggerpostun base -- %{name} < 1.3.33-6.7
+# update /etc/sysconfig/apache1 -> apache rename
+if [ -f /etc/sysconfig/apache1.rpmsave ]; then
+ cp -f /etc/sysconfig/apache{,.rpmnew}
+ mv -f /etc/sysconfig/apache{1.rpmsave,}
+fi
+
+%triggerpostun base -- %{name} < 1.3.34-5.9
+if ! grep -q 'Include webapps.d/' /etc/apache/apache.conf; then
+# make sure webapps.d is included
+cp -f /etc/apache/apache.conf{,.rpmsave}
+sed -i -e '
+ /^Include conf.d/{
+ a
+ a# Include webapps config
+ aInclude webapps.d/*.conf
+ }
+' /etc/apache/apache.conf
+fi
+
+%triggerpostun mod_auth_db -- apache-mod_auth_db < 1.3.20-16
+sed -i -e '/^\(Add\|Load\)Module.*mod_auth_dbm\.\(so\|c\)/d' /etc/apache/apache.conf
+
+%triggerpostun mod_autoindex -- apache1-mod_autoindex < 1.3.33-1.85
+sed -i -e '
+ /^\(Add\|Load\)Module.*mod_autoindex\.\(so\|c\)/d
+ s,^Include.*mod_autoindex.conf,Include %{_sysconfdir}/conf.d/*_mod_autoindex.conf,
+' /etc/apache/apache.conf
+
+%triggerpostun mod_proxy -- apache1-mod_proxy < 1.3.33-1.85
+sed -i -e '
+ /^LoadModule.*libproxy\.so/d
+ /^AddModule.*mod_proxy\.c/d
+ s,^Include.*mod_proxy.conf,Include %{_sysconfdir}/conf.d/*_mod_proxy.conf,
+' /etc/apache/apache.conf
+
+%triggerpostun mod_status -- apache1-mod_status < 1.3.33-1.85
+sed -i -e '
+ /^\(Add\|Load\)Module.*mod_status\.\(so\|c\)/d
+ s,^Include.*mod_status.conf,Include %{_sysconfdir}/conf.d/*_mod_status.conf,
+' /etc/apache/apache.conf
+
+%triggerpostun mod_vhost_alias -- apache1-mod_vhost_alias < 1.3.33-1.85
+sed -i -e '
+ /^\(Add\|Load\)Module.*mod_vhost_alias\.\(so\|c\)/d
+ s,^Include.*mod_vhost_alias.conf,Include %{_sysconfdir}/conf.d/*_mod_vhost_alias.conf,
+' /etc/apache/apache.conf
+
+%posttrans base
+# minimizing apache restarts logics. we restart webserver:
+#
+# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
+# 2. first install of module (post: $1 = 1)
+# 2. uninstall of module (postun: $1 == 0)
+#
+# the strict internal deps between apache modules and
+# main package are very important for all this to work.
+
+# restart webserver at the end of transaction
+%service apache restart "Apache HTTP daemon"
+
+# macro called at module post scriptlet
+%define module_post \
+if [ "$1" = "1" ]; then \
+ %service -q apache restart \
+fi
+
+# macro called at module postun scriptlet
+%define module_postun \
+if [ "$1" = "0" ]; then \
+ %service -q apache restart \
+fi
+