#!/bin/sh
#
# Script to update all indexes for the WN web server setup
# Christoph Lameter, November 4, 1996
#
set -e

function recurse()
{
	local x
	local XX
	cd $1
	if [ ! -e index ]; then
		echo "Attribute=serveall" >index
	fi
#	echo `pwd`
#	if [ ! -f index.cache -o index -nt index.cache ]; then
 		/usr/sbin/wndex >/dev/null
#	fi
	for x in *; do
		if [ ! -L $x -a -d $x ]; then
			recurse $x
		fi
	done
}

for i in /var/wn /var/lib/debian-www/{cgi-bin,documents} \
		 /usr/lib/debian-www/documents /usr/doc; do
	if [ ! -L $i -a -d $i ]; then
		recurse $i
	else
		echo "$i is not a directory"
	fi
done
