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 |
2 | |
19 | |
3 | umask 022 |
20 | umask 022 |
4 | |
21 | |
5 | PATH=/root/src/crossfire:$PATH |
22 | PATH=/root/src/crossfire:$PATH |
6 | BASE=/var/www/cfmaps.schmorp.de |
23 | BASE=/var/www/cfmaps.schmorp.de |
7 | export CROSSFIRE_LIBDIR=$BASE/lib |
24 | export CROSSFIRE_LIBDIR=$BASE/lib |
8 | |
25 | |
9 | cd "$BASE" || exit 69 |
26 | cd "$BASE" || exit 69 |
10 | |
27 | |
|
|
28 | VERSION=1.01 |
|
|
29 | |
11 | cvs -Q -z3 update -AdP | grep -v ^\\? |
30 | cvs -Q -z3 update -AdP | grep -v ^\\? |
12 | |
|
|
13 | chown -R root.root . |
|
|
14 | chmod -R u=rwX,go=rX . |
|
|
15 | |
31 | |
16 | rm -f .cfmap2html |
32 | rm -f .cfmap2html |
17 | |
33 | |
18 | 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 |
19 | ( |
35 | ( |
20 | export dir |
36 | export dir |
21 | cd "./$dir" || exit 68 |
37 | cd "./$dir" || exit 68 |
22 | { |
38 | { |
23 | echo "<html><head><title>$dir</title></head><body><ul>" >&7 |
39 | echo "<html><head><title>Crossfire Maps Directory \"$dir\"</title></head><body><h1>Crossfire Maps Directory \"$dir\"</h1><ul>" >&7 |
24 | echo "<li><a href='..'><parent></a></li>" >&7 |
40 | echo "<li><a href='..'><parent></a></li></ul><h2>This Directory</h2><ul>" >&7 |
25 | for file in *; do |
41 | for file in *; do |
26 | if [ -f "$file" ]; then |
42 | if [ -f "$file" ]; then |
27 | case "$file" in |
43 | case "$file" in |
28 | *.pst | *.jpg | *.png | *.html | *.html.gz | *~ ) |
44 | *.pst | *.jpg | *.png | *.html | *.html.gz | *~ ) |
29 | ;; |
45 | ;; |
… | |
… | |
45 | echo "<li><a href='$file/'>$file/</a> [dir]</li>" >&7 |
61 | echo "<li><a href='$file/'>$file/</a> [dir]</li>" >&7 |
46 | ;; |
62 | ;; |
47 | esac |
63 | esac |
48 | fi |
64 | fi |
49 | done |
65 | done |
|
|
66 | echo "</ul>" >&7 |
|
|
67 | cat <<EOF >&7 |
|
|
68 | <h2>Bookmarks</h2> |
|
|
69 | <ul> |
|
|
70 | <li><a href="/world/">Worldmap</a></li> |
|
|
71 | <li><a href="/world/world_105_115.html">Scorn</a></li> |
|
|
72 | <li><a href="/world/world_102_108.html">Santo Dominion</a></li> |
|
|
73 | <li><a href="/world/world_107_123.html">Brest</a></li> |
|
|
74 | <li><a href="/world/world_109_126.html">Lake Country</a></li> |
|
|
75 | <li><a href="/world/world_122_117.html">Navar</a></li> |
|
|
76 | <li><a href="/world/world_116_102.html">Darcap</a></li> |
|
|
77 | <li><a href="/world/world_128_109.html">Wolfsburg</a></li> |
|
|
78 | <li><a href="/world/world_128_101.html">Azumauindo</a></li> |
|
|
79 | </ul> |
|
|
80 | <hr /> |
|
|
81 | <p style='font-size: 8pt;'>created by <b>update</b> version $VERSION</p> |
|
|
82 | EOF |
50 | echo "</ul></body></html>" >&7 |
83 | echo "</body></html>" >&7 |
51 | } 7>index.html |
84 | } 7>index.html |
52 | ) |
85 | ) |
53 | done |
86 | done |
54 | |
87 | |
55 | <.cfmap2html xargs cfmap2html |
88 | <.cfmap2html xargs cfmap2html |
|
|
89 | rm -f .cfmap2html |
|
|
90 | |
|
|
91 | cfarch2html |
|
|
92 | cfworldmap |
|
|
93 | |
|
|
94 | chown -R root.root . |
|
|
95 | chmod -R u=rwX,go=rX . |
|
|
96 | |