--- cfmaps/cfupdate 2005/11/18 23:33:09 1.4
+++ cfmaps/cfupdate 2007/02/14 02:38:40 1.22
@@ -1,38 +1,84 @@
#!/bin/bash
+# cfupdate - convert a crossfire maps hierarchy to html
+# Copyright (C) 2005,2007 Marc Lehmann
+#
+# CFUPDATE is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with gvpe; if not, write to the Free Software
+# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+VERSION=1.112
+
umask 022
-PATH=/root/src/crossfire:$PATH
-BASE=/var/www/cfmaps.schmorp.de
-export CROSSFIRE_LIBDIR=$BASE/lib
+SRC=/root/src/cfmaps
+PATH="$SRC:$PATH"
+BASE="/var/www/cfmaps.schmorp.de"
+export CROSSFIRE_LIBDIR="$BASE"/lib
cd "$BASE" || exit 69
-VERSION=1.0
-
cvs -Q -z3 update -AdP | grep -v ^\\?
+#wget -qm --no-check-certificate https://cat2.dynu.ca/cat2/mlab-devel.tar.gz
+#if [ cat2.dynu.ca/cat2/mlab-devel.tar.gz -nt cat2.dynu.ca/cat2/mlab-devel.tar.gz~ ]; then
+# tar xzpf cat2.dynu.ca/cat2/mlab-devel.tar.gz
+# chown -R root.root mlab-devel
+# chmod -R u=rwX,go=rX mlab-devel
+# ln -f cat2.dynu.ca/cat2/mlab-devel.tar.gz cat2.dynu.ca/cat2/mlab-devel.tar.gz~
+#fi
+
rm -f .cfmap2html
-find . -name CVS -prune -o -type d -printf "%P/\n" | while read dir; do
+chmod 644 "$SRC"/*.css
+cp "$SRC"/*.css .
+chmod 755 "$SRC"/cfmapidx
+cp "$SRC"/cfmapidx .
+
+find . "(" -name CVS -o -path ./a ")" -prune -o -type d -printf "%P/\n" | while read dir; do
(
export dir
cd "./$dir" || exit 68
{
- echo "Crossfire Maps: $dirCrossfire Maps $dir
This Directory
+ Crossfire Maps Directory "$dir"
This Directory
+ EOF
for file in *; do
if [ -f "$file" ]; then
case "$file" in
- *.pst | *.jpg | *.png | *.html | *.html.gz | *~ )
+ cfmapidx | *.pst | *.jpg | *.png | *.html | *.html.gz | *.xhtml | *.xhtml.gz | *.css | *~ )
;;
* )
if head -5 "$file" | grep -q "^arch map"; then
- echo "- $file [map]
" >&7
+ echo >&7 "- ${file%.map} [map]
"
DIR="${dir#/}"
echo "$DIR$file" >>$BASE/.cfmap2html
else
- echo "- $file [file]
" >&7
+ echo >&7 "- $file [file]
"
fi
;;
esac
@@ -41,38 +87,48 @@
CVS )
;;
* )
- echo "- $file/ [dir]
" >&7
+ echo >&7 "- $file/ [dir]
"
;;
esac
fi
done
- echo "
" >&7
- cat <&7
-Bookmarks
-
-
-created by update version $VERSION
-EOF
- echo "" >&7
- } 7>index.html
+ echo >&7 ""
+ cat >&7 <<-EOF
+ Bookmarks
+
+
+ EOF
+ echo >&7 ""
+ } 7>index.xhtml~
+
+ if [ "$DIR" = "world/" -o "$DIR" = "world-overlay/" ]; then
+ rm index.xhtml~
+ else
+ mv index.xhtml~ index.xhtml
+ fi
+ #gzip -7f index.xhtml
)
done
<.cfmap2html xargs cfmap2html
-rm -f .cfmap2html
+<.cfmap2html xargs cfmapidx -a
+mv .index.dat~ .index.dat
+
+#rm -f .cfmap2html
cfarch2html
-cfworldmap
+cfworldmap world
+cfworldmap world-overlay
chown -R root.root .
chmod -R u=rwX,go=rX .