1 | #!/bin/bash |
1 | #!/bin/bash |
|
|
2 | |
|
|
3 | # cfupdate - convert a crossfire maps hierarchy to html |
|
|
4 | # Copyright (C) 2005 Marc Lehmann <gvpe@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 gvpe; if not, write to the Free Software |
|
|
18 | # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
19 | |
|
|
20 | VERSION=1.02 |
2 | |
21 | |
3 | umask 022 |
22 | umask 022 |
4 | |
23 | |
5 | PATH=/root/src/crossfire:$PATH |
24 | PATH=/root/src/crossfire:$PATH |
6 | BASE=/var/www/cfmaps.schmorp.de |
25 | BASE=/var/www/cfmaps.schmorp.de |
7 | export CROSSFIRE_LIBDIR=$BASE/lib |
26 | export CROSSFIRE_LIBDIR=$BASE/lib |
8 | |
27 | |
9 | cd "$BASE" || exit 69 |
28 | cd "$BASE" || exit 69 |
10 | |
|
|
11 | VERSION=1.0 |
|
|
12 | |
29 | |
13 | cvs -Q -z3 update -AdP | grep -v ^\\? |
30 | cvs -Q -z3 update -AdP | grep -v ^\\? |
14 | |
31 | |
15 | rm -f .cfmap2html |
32 | rm -f .cfmap2html |
16 | |
33 | |
17 | find . -name CVS -prune -o -type d -printf "%P/\n" | while read dir; do |
34 | find . -name CVS -prune -o -type d -printf "%P/\n" | while read dir; do |
18 | ( |
35 | ( |
19 | export dir |
36 | export dir |
20 | cd "./$dir" || exit 68 |
37 | cd "./$dir" || exit 68 |
21 | { |
38 | { |
22 | echo "<html><head><title>Crossfire Maps: $dir</title></head><body><h1>Crossfire Maps $dir</h1><h2>This Directory</h2><ul>" >&7 |
39 | echo "<html><head><title>Crossfire Maps Directory \"$dir\"</title></head><body><h1>Crossfire Maps Directory \"$dir\"</h1><ul>" >&7 |
23 | echo "<li><a href='..'><parent></a></li>" >&7 |
40 | echo "<li><a href='..'><parent></a></li></ul><h2>This Directory</h2><ul>" >&7 |
24 | for file in *; do |
41 | for file in *; do |
25 | if [ -f "$file" ]; then |
42 | if [ -f "$file" ]; then |
26 | case "$file" in |
43 | case "$file" in |
27 | *.pst | *.jpg | *.png | *.html | *.html.gz | *~ ) |
44 | *.pst | *.jpg | *.png | *.html | *.html.gz | *~ ) |
28 | ;; |
45 | ;; |
… | |
… | |
48 | done |
65 | done |
49 | echo "</ul>" >&7 |
66 | echo "</ul>" >&7 |
50 | cat <<EOF >&7 |
67 | cat <<EOF >&7 |
51 | <h2>Bookmarks</h2> |
68 | <h2>Bookmarks</h2> |
52 | <ul> |
69 | <ul> |
53 | <li><a href="/world/worldmap.html">Worldmap</a></li> |
70 | <li><a href="/world/">Worldmap</a></li> |
54 | <li><a href="/world/world_105_115.html">Scorn</a></li> |
71 | <li><a href="/world/world_105_115.html">Scorn</a></li> |
55 | <li><a href="/world/world_102_108.html">Santo Dominion</a></li> |
72 | <li><a href="/world/world_102_108.html">Santo Dominion</a></li> |
56 | <li><a href="/world/world_107_123.html">Brest</a></li> |
73 | <li><a href="/world/world_107_123.html">Brest</a></li> |
57 | <li><a href="/world/world_109_126.html">Lake Country</a></li> |
74 | <li><a href="/world/world_109_126.html">Lake Country</a></li> |
58 | <li><a href="/world/world_122_117.html">Navar</a></li> |
75 | <li><a href="/world/world_122_117.html">Navar</a></li> |
59 | <li><a href="/world/world_116_102.html">Darcap</a></li> |
76 | <li><a href="/world/world_116_102.html">Darcap</a></li> |
60 | <li><a href="/world/world_128_109.html">Wolfsburg</a></li> |
77 | <li><a href="/world/world_128_109.html">Wolfsburg</a></li> |
61 | <li><a href="/world/world_128_101.html">Azumauindo</a></li> |
78 | <li><a href="/world/world_128_101.html">Azumauindo</a></li> |
62 | </ul> |
79 | </ul> |
63 | <hr /> |
80 | <hr /> |
64 | <p style='font-size: 8pt;'>created by <b>update</b> version $VERSION</p> |
81 | <p style='font-size: 8pt;'>created by <a href='http://software.schmorp.de/#crossfire'>cfupdate</a> version $VERSION</p> |
65 | EOF |
82 | EOF |
66 | echo "</body></html>" >&7 |
83 | echo "</body></html>" >&7 |
67 | } 7>index.html |
84 | } 7>index.html |
68 | ) |
85 | ) |
69 | done |
86 | done |