--- apache-module.eclass.orig 2005-02-12 17:41:35.270966441 -0800 +++ apache-module.eclass 2005-02-12 17:42:36.363476471 -0800 @@ -217,6 +217,10 @@ einfo "You may want to edit it before turning the module on in /etc/conf.d/apache" einfo fi + + if [ -n "${APACHE1_MOD_DIRINDEX}" ] ; then + apache-module_add_directoryindex ${APACHE1_MOD_DIRINDEX} + fi } ###### @@ -328,6 +332,10 @@ einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" einfo fi + + if [ -n "${APACHE2_MOD_DIRINDEX}" ] ; then + apache-module_add_directoryindex ${APACHE2_MOD_DIRINDEX} + fi } ###### @@ -377,6 +385,34 @@ fi } + +apache-module_add_directoryindex() { + debug-print-function apache-module_add_directoryindex + + if [ ${APACHE_VERISON} -eq '1' ]; then + HTTPD_CONF=${APACHE1_CONFDIR}/httpd.conf + else + HTTPD_CONF=${APACHE2_CONFDIR}/httpd.conf + fi + + until [ -z "$1" ] + do + DIRIDX=$(grep -m 1 '^DirectoryIndex' ${HTTPD_CONF}) + if ! hasq $1 ${DIRIDX}; then + NEW_DIRIDX="${NEW_DIRIDX} $1" + fi + shift + done + + if [ -n "${NEW_DIRIDX}" ] ; then + einfo "Adding${NEW_DIRIDX} to DirectoryIndex of ${HTTPD_CONF}" + NEW_DIRIDX="# ${DIRIDX}\n#${NEW_DIRIDX} automaticly added by ${PF}\n${DIRIDX}${NEW_DIRIDX}" + cp ${HTTPD_CONF} ${T}/httpd.conf.bak + sed "s/^DirectoryIndex .*$/${NEW_DIRIDX}/" < ${T}/httpd.conf.bak > ${HTTPD_CONF} + fi + +} + EXPORT_FUNCTIONS pkg_setup src_compile src_install pkg_postinst # vim:ts=4