#!/bin/bash
umask 022
PATH=/root/src/crossfire:$PATH
BASE=/var/www/cfmaps.schmorp.de
export CROSSFIRE_LIBDIR=$BASE/lib
cd "$BASE" || exit 69
cvs -Q -z3 update -AdP | grep -v ^\\?
chown -R root.root .
chmod -R u=rwX,go=rX .
rm -f .cfmap2html
find . -name CVS -prune -o -type d -printf "%P/\n" | while read dir; do
(
export dir
cd "./$dir" || exit 68
{
echo "
$dir" >&7
echo "- <parent>
" >&7
for file in *; do
if [ -f "$file" ]; then
case "$file" in
*.pst | *.jpg | *.png | *.html | *.html.gz | *~ )
;;
* )
if head -5 "$file" | grep -q "^arch map"; then
echo "- $file [map]
" >&7
DIR="${dir#/}"
echo "$DIR$file" >>$BASE/.cfmap2html
else
echo "- $file [file]
" >&7
fi
;;
esac
elif [ -d "$file" ]; then
case "$file" in
CVS )
;;
* )
echo "- $file/ [dir]
" >&7
;;
esac
fi
done
echo "
" >&7
} 7>index.html
)
done
<.cfmap2html xargs cfmap2html
rm -f .cfmap2html
cfarch2html