ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cfmaps/cfupdate
(Generate patch)

Comparing cfmaps/cfupdate (file contents):
Revision 1.5 by root, Fri Nov 18 23:43:12 2005 UTC vs.
Revision 1.40 by root, Tue Oct 27 03:48:17 2009 UTC

1#!/bin/bash 1#!/bin/bash
2
3# cfupdate - convert a deliantra maps hierarchy to html
4# Copyright (C) 2005,2007,2008 Marc Lehmann <cfmaps@schmorp.de>
5#
6# CFUPDATE is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with cfmaps; if not, write to the Free Software
18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20VERSION=2.033
2 21
3umask 022 22umask 022
4 23
5PATH=/root/src/crossfire:$PATH 24SRC=/root/src/cfmaps
6BASE=/var/www/cfmaps.schmorp.de 25PATH="$SRC:$PATH"
7export CROSSFIRE_LIBDIR=$BASE/lib 26export BASE=${BASE:-/var/www/maps.deliantra.net}
27export DELIANTRA_LIBDIR=${DELIANTRA_LIBDIR:-$BASE/lib}
8 28
9cd "$BASE" || exit 69 29cd "$BASE" || exit 69
10 30
11VERSION=1.01 31#wget -qm --no-check-certificate https://cat2.dynu.ca/cat2/mlab-devel.tar.gz
12 32#if [ cat2.dynu.ca/cat2/mlab-devel.tar.gz -nt cat2.dynu.ca/cat2/mlab-devel.tar.gz~ ]; then
13cvs -Q -z3 update -AdP | grep -v ^\\? 33# tar xzpf cat2.dynu.ca/cat2/mlab-devel.tar.gz
34# chown -R root.root mlab-devel
35# chmod -R u=rwX,go=rX mlab-devel
36# ln -f cat2.dynu.ca/cat2/mlab-devel.tar.gz cat2.dynu.ca/cat2/mlab-devel.tar.gz~
37#fi
14 38
15rm -f .cfmap2html 39rm -f .cfmap2html
16 40
41chmod 644 "$SRC"/*.css
42cp "$SRC"/*.css .
43chmod 755 "$SRC"/cfmapidx
44cp "$SRC"/cfmapidx .
45
17find . -name CVS -prune -o -type d -printf "%P/\n" | while read dir; do 46find . "(" -name CVS -o -path ./a -o -name .svn ")" -prune -o -type d -printf "%P/\n" | while read dir; do
18 ( 47 (
19 export dir 48 export dir
20 cd "./$dir" || exit 68 49 cd "./$dir" || exit 68
21 { 50 {
22 echo "<html><head><title>Crossfire Maps Directory \"$dir\"</title></head><body><h1>Crossfire Maps Directory \"$dir\"</h1><h2>This Directory</h2><ul>" >&7 51 cat >&7 <<-EOF
23 echo "<li><a href='..'>&lt;parent&gt;</a></li>" >&7 52 <?xml version='1.0' encoding='utf-8'?>
53 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
54 <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
55 <head>
56 <title>Deliantra Maps Directory "$dir"</title>
57 <link rel='stylesheet' type='text/css' media='all' href='/common.css'/>
58 </head>
59 <body>
60 <p>Keyword Search Over All Maps</p>
61 <form action='/search'><p>
62 <input type='text' name='k'/>
63 <input type='submit'/>
64 </p></form>
65 <h1>Deliantra Maps Directory "$dir"</h1><ul>
66 <li><a href='..'>&lt;parent&gt;</a></li></ul><h2>This Directory</h2><ul>
67 EOF
24 for file in *; do 68 for file in *; do
69 if [ -h "$file" ]; then
70 : # ignore for now
25 if [ -f "$file" ]; then 71 elif [ -f "$file" ]; then
26 case "$file" in 72 case "$file" in
27 *.pst | *.jpg | *.png | *.html | *.html.gz | *~ ) 73 cfmapidx | *.jpg | *.png | *.html | *.html.gz | *.xhtml | *.xhtml.gz | *.css | *.err | *~ )
74 ;;
75 *.map )
76 echo >&7 "<li><a href='${file%.map}.xhtml'>${file%.map}</a> [map] <img class='mapthumb' src='${file%.map}.jpg' /></li>"
77 DIR="${dir#/}"
78 echo "$DIR$file" >>$BASE/.cfmap2html
28 ;; 79 ;;
29 * ) 80 * )
81 # non-deliantra compatibility
30 if head -5 "$file" | grep -q "^arch map"; then 82 if [ "$(head -1 "$file")" = "arch map" ]; then
31 echo "<li><a href='$file.html'>$file</a> [map]</li>" >&7 83 echo >&7 "<li><a href='$file.xhtml'>$file</a> [map] <img class='mapthumb' src='$file.jpg' /></li>"
84 ln -sf "$file" "$file.map"
32 DIR="${dir#/}" 85 DIR="${dir#/}"
33 echo "$DIR$file" >>$BASE/.cfmap2html 86 echo "$DIR$file.map" >>$BASE/.cfmap2html
34 else 87 else
35 echo "<li><a href='$file'>$file</a> [file]</li>" >&7 88 echo >&7 "<li><a href='$file'>$file</a> [file]</li>"
36 fi 89 fi
37 ;; 90 ;;
38 esac 91 esac
39 elif [ -d "$file" ]; then 92 elif [ -d "$file" ]; then
40 case "$file" in 93 case "$file" in
41 CVS ) 94 CVS )
42 ;; 95 ;;
43 * ) 96 * )
44 echo "<li><a href='$file/'>$file/</a> [dir]</li>" >&7 97 echo >&7 "<li><a href='$file/'>$file/</a> [dir]</li>"
45 ;; 98 ;;
46 esac 99 esac
47 fi 100 fi
48 done 101 done
49 echo "</ul>" >&7 102 echo >&7 "</ul>"
50 cat <<EOF >&7 103 cat >&7 <<-EOF
51<h2>Bookmarks</h2> 104 <h2>Bookmarks</h2>
52<ul> 105 <ul>
53 <li><a href="/world/">Worldmap</a></li> 106 <li><a href="/world/">Worldmap</a></li>
54 <li><a href="/world/world_105_115.html">Scorn</a></li> 107 <li><a href="/world/world_105_115.xhtml">Scorn</a></li>
55 <li><a href="/world/world_102_108.html">Santo Dominion</a></li> 108 <li><a href="/world/world_102_108.xhtml">Santo Dominion</a></li>
56 <li><a href="/world/world_107_123.html">Brest</a></li> 109 <li><a href="/world/world_107_123.xhtml">Brest</a></li>
57 <li><a href="/world/world_109_126.html">Lake Country</a></li> 110 <li><a href="/world/world_109_126.xhtml">Lake Country</a></li>
58 <li><a href="/world/world_122_117.html">Navar</a></li> 111 <li><a href="/world/world_122_117.xhtml">Navar</a></li>
59 <li><a href="/world/world_116_102.html">Darcap</a></li> 112 <li><a href="/world/world_116_102.xhtml">Darcap</a></li>
60 <li><a href="/world/world_128_109.html">Wolfsburg</a></li> 113 <li><a href="/world/world_128_109.xhtml">Wolfsburg</a></li>
61 <li><a href="/world/world_128_101.html">Azumauindo</a></li> 114 <li><a href="/world/world_128_101.xhtml">Azumauindo</a></li>
62</ul> 115 </ul>
63<hr /> 116 <p class="footer">created by <a href='http://software.schmorp.de/pkg/cfmaps'>cfupdate</a> version $VERSION</p>
64<p style='font-size: 8pt;'>created by <b>update</b> version $VERSION</p>
65EOF 117 EOF
66 echo "</body></html>" >&7 118 echo >&7 "</body></html>"
67 } 7>index.html 119 } 7>index.xhtml~
120
121 if [ "$DIR" = "world/" -o "$DIR" = "world-overlay/" ]; then
122 rm index.xhtml~
123 else
124 mv index.xhtml~ index.xhtml
125 fi
126 #gzip -7f index.xhtml
68 ) 127 )
69done 128done
70 129
71<.cfmap2html xargs cfmap2html 130for dir in *; do
72rm -f .cfmap2html 131 if [ -e "$dir/${dir}_123_107.map" ]; then
132 cfworldmap "$dir"
133 fi
134done
73 135
74cfarch2html 136cfarch2html
75cfworldmap 137
138rm -f .index.dat~
139<.cfmap2html xargs -l100 cfmap2html
140<.cfmap2html xargs -l200 cfmapidx -a
141mv .index.dat~ .index.dat
142
143#rm -f .cfmap2html
76 144
77chown -R root.root . 145chown -R root.root .
78chmod -R u=rwX,go=rX . 146chmod -R u=rwX,go=rX .
79 147

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines