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,2007 Marc Lehmann <cfmaps@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 | |
20 | VERSION=1.112 |
20 | VERSION=2.033 |
21 | |
21 | |
22 | umask 022 |
22 | umask 022 |
23 | |
23 | |
24 | SRC=/root/src/cfmaps |
24 | SRC=/root/src/cfmaps |
25 | PATH="$SRC:$PATH" |
25 | PATH="$SRC:$PATH" |
26 | BASE="/var/www/cfmaps.schmorp.de" |
26 | export BASE=${BASE:-/var/www/maps.deliantra.net} |
27 | export CROSSFIRE_LIBDIR="$BASE"/lib |
27 | export DELIANTRA_LIBDIR=${DELIANTRA_LIBDIR:-$BASE/lib} |
28 | |
28 | |
29 | cd "$BASE" || exit 69 |
29 | cd "$BASE" || exit 69 |
30 | |
|
|
31 | cvs -Q -z3 update -AdP | grep -v ^\\? |
|
|
32 | |
30 | |
33 | #wget -qm --no-check-certificate https://cat2.dynu.ca/cat2/mlab-devel.tar.gz |
31 | #wget -qm --no-check-certificate https://cat2.dynu.ca/cat2/mlab-devel.tar.gz |
34 | #if [ cat2.dynu.ca/cat2/mlab-devel.tar.gz -nt cat2.dynu.ca/cat2/mlab-devel.tar.gz~ ]; then |
32 | #if [ cat2.dynu.ca/cat2/mlab-devel.tar.gz -nt cat2.dynu.ca/cat2/mlab-devel.tar.gz~ ]; then |
35 | # tar xzpf cat2.dynu.ca/cat2/mlab-devel.tar.gz |
33 | # tar xzpf cat2.dynu.ca/cat2/mlab-devel.tar.gz |
36 | # chown -R root.root mlab-devel |
34 | # chown -R root.root mlab-devel |
… | |
… | |
43 | chmod 644 "$SRC"/*.css |
41 | chmod 644 "$SRC"/*.css |
44 | cp "$SRC"/*.css . |
42 | cp "$SRC"/*.css . |
45 | chmod 755 "$SRC"/cfmapidx |
43 | chmod 755 "$SRC"/cfmapidx |
46 | cp "$SRC"/cfmapidx . |
44 | cp "$SRC"/cfmapidx . |
47 | |
45 | |
48 | find . "(" -name CVS -o -path ./a ")" -prune -o -type d -printf "%P/\n" | while read dir; do |
46 | find . "(" -name CVS -o -path ./a -o -name .svn ")" -prune -o -type d -printf "%P/\n" | while read dir; do |
49 | ( |
47 | ( |
50 | export dir |
48 | export dir |
51 | cd "./$dir" || exit 68 |
49 | cd "./$dir" || exit 68 |
52 | { |
50 | { |
53 | cat >&7 <<-EOF |
51 | cat >&7 <<-EOF |
54 | <?xml version='1.0' encoding='utf-8'?> |
52 | <?xml version='1.0' encoding='utf-8'?> |
55 | <!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"> |
56 | <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'> |
54 | <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'> |
57 | <head> |
55 | <head> |
58 | <title>Crossfire Maps Directory "$dir"</title> |
56 | <title>Deliantra Maps Directory "$dir"</title> |
59 | <link rel='stylesheet' type='text/css' media='all' href='/common.css'/> |
57 | <link rel='stylesheet' type='text/css' media='all' href='/common.css'/> |
60 | </head> |
58 | </head> |
61 | <body> |
59 | <body> |
62 | <p>Keyword Search Over All Maps</p> |
60 | <p>Keyword Search Over All Maps</p> |
63 | <p><form action='/search'> |
61 | <form action='/search'><p> |
64 | <input type='text' name='k'/> |
62 | <input type='text' name='k'/> |
65 | <input type='submit'/> |
63 | <input type='submit'/> |
66 | </form></p> |
64 | </p></form> |
67 | <h1>Crossfire Maps Directory "$dir"</h1><ul> |
65 | <h1>Deliantra Maps Directory "$dir"</h1><ul> |
68 | <li><a href='..'><parent></a></li></ul><h2>This Directory</h2><ul> |
66 | <li><a href='..'><parent></a></li></ul><h2>This Directory</h2><ul> |
69 | EOF |
67 | EOF |
70 | for file in *; do |
68 | for file in *; do |
|
|
69 | if [ -h "$file" ]; then |
|
|
70 | : # ignore for now |
71 | if [ -f "$file" ]; then |
71 | elif [ -f "$file" ]; then |
72 | case "$file" in |
72 | case "$file" in |
73 | cfmapidx | *.pst | *.jpg | *.png | *.html | *.html.gz | *.xhtml | *.xhtml.gz | *.css | *~ ) |
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 |
74 | ;; |
79 | ;; |
75 | * ) |
80 | * ) |
|
|
81 | # non-deliantra compatibility |
76 | if head -5 "$file" | grep -q "^arch map"; then |
82 | if [ "$(head -1 "$file")" = "arch map" ]; then |
77 | 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" |
78 | DIR="${dir#/}" |
85 | DIR="${dir#/}" |
79 | echo "$DIR$file" >>$BASE/.cfmap2html |
86 | echo "$DIR$file.map" >>$BASE/.cfmap2html |
80 | else |
87 | else |
81 | echo >&7 "<li><a href='$file'>$file</a> [file]</li>" |
88 | echo >&7 "<li><a href='$file'>$file</a> [file]</li>" |
82 | fi |
89 | fi |
83 | ;; |
90 | ;; |
84 | esac |
91 | esac |
… | |
… | |
118 | fi |
125 | fi |
119 | #gzip -7f index.xhtml |
126 | #gzip -7f index.xhtml |
120 | ) |
127 | ) |
121 | done |
128 | done |
122 | |
129 | |
123 | exit |
130 | for dir in *; do |
|
|
131 | if [ -e "$dir/${dir}_123_107.map" ]; then |
|
|
132 | cfworldmap "$dir" |
|
|
133 | fi |
|
|
134 | done |
124 | |
135 | |
|
|
136 | cfarch2html |
|
|
137 | |
|
|
138 | rm -f .index.dat~ |
125 | <.cfmap2html xargs cfmap2html |
139 | <.cfmap2html xargs -l100 cfmap2html |
126 | <.cfmap2html xargs cfmapidx -a |
140 | <.cfmap2html xargs -l200 cfmapidx -a |
127 | mv .index.dat~ .index.dat |
141 | mv .index.dat~ .index.dat |
128 | |
142 | |
129 | #rm -f .cfmap2html |
143 | #rm -f .cfmap2html |
130 | |
144 | |
131 | cfarch2html |
|
|
132 | cfworldmap world |
|
|
133 | cfworldmap world-overlay |
|
|
134 | |
|
|
135 | chown -R root.root . |
145 | chown -R root.root . |
136 | chmod -R u=rwX,go=rX . |
146 | chmod -R u=rwX,go=rX . |
137 | |
147 | |