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

Comparing cfmaps/cfupdate (file contents):
Revision 1.14 by root, Wed Nov 23 09:07:21 2005 UTC vs.
Revision 1.42 by root, Thu Jan 14 18:29:03 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines