+%triggerin -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerpostun -- %{name} < 4.6.4-0.4
+# rescue app configs.
+if [ -f /etc/drupal/sites/default/settings.php.rpmsave ]; then
+ mv -f %{_sysconfdir}/sites/default/settings.php{,.rpmnew}
+ mv -f /etc/drupal/sites/default/settings.php.rpmsave %{_sysconfdir}/sites/default/settings.php
+fi
+# other configured sites, if any
+for i in /etc/drupal/sites/*; do
+ d=$(basename $i)
+ [ "$d" = "default" ] && continue
+ mv -f %{_sysconfdir}/sites/$d{,.rpmnew}
+ mv -f $i %{_sysconfdir}/sites/$d
+done
+
+# migrate from apache-config macros
+if [ -f /etc/drupal/apache.conf.rpmsave ]; then
+ if [ -d /etc/apache/webapps.d ]; then
+ cp -f %{_sysconfdir}/apache.conf{,.rpmnew}
+ cp -f /etc/drupal/apache.conf.rpmsave %{_sysconfdir}/apache.conf
+ fi
+
+ if [ -d /etc/httpd/webapps.d ]; then
+ cp -f %{_sysconfdir}/httpd.conf{,.rpmnew}
+ cp -f /etc/drupal/apache.conf.rpmsave %{_sysconfdir}/httpd.conf
+ fi
+ rm -f /etc/drupal/apache.conf.rpmsave
+fi