+%post mod_autoindex
+if [ "$1" = "0" ]; then
+ if [ -f /etc/apache/apache.conf ] && ! grep -q "^Include.*mod_autoindex.conf" /etc/apache/apache.conf; then
+ echo "Include /etc/apache/mod_autoindex.conf" >> /etc/apache/apache.conf
+ fi
+ %{apxs} -e -a -n autoindex %{_libexecdir}/mod_autoindex.so 1>&2
+ if [ -f /var/lock/subsys/apache ]; then
+ /etc/rc.d/init.d/apache restart 1>&2
+ fi
+fi
+
+%preun mod_autoindex
+if [ "$1" = "0" ]; then
+ umask 027
+ %{apxs} -e -A -n autoindex %{_libexecdir}/mod_autoindex.so 1>&2
+ grep -v "^Include.*mod_autoindex.conf" /etc/apache/apache.conf > \
+ /etc/apache/apache.conf.tmp
+ mv -f /etc/apache/apache.conf.tmp /etc/apache/apache.conf
+ if [ -f /var/lock/subsys/apache ]; then
+ /etc/rc.d/init.d/apache restart 1>&2
+ fi
+fi
+