#!/bin/sh

cache () {
	cd $1
	sounds=`echo *`
	num=`echo * | wc -w`
	echo "set ${1}Sounds {$sounds}" >> ../audio.tcl
	echo "set ${1}Size $num" >> ../audio.tcl
	echo " " >> ../audio.tcl
	cd ..
}

cd audio
/bin/rm -f audio.tcl
cache join
cache leave
cache start
cache enter
cache exit
cd ..

cd src/script
make install
cd ../..

/bin/find . -name \*~ -exec rm -f {} \; -print
/bin/find . -name core -exec rm -f {} \; -print
FILES=`/bin/find * \( -type f -o -type l \) -print | /bin/egrep -v \
	'SCCS|^arenacache|^arenasum|^cleanup|^doom.*wad|^incoming|^server|^src|^wads|^zip' | sort`

/bin/rm -f arenasum
for i in $FILES ; do
  if [ ! -h $i ] ; then
    /bin/sum -r $i >> arenasum
  else
    symlink=`/bin/ls -l $i | /bin/awk '{ print $11 }'`
    checksum=`echo $symlink | /bin/sum -r`
    echo "$checksum$i" >> arenasum
  fi
done
