1 |
root |
1.1 |
#!/bin/bash |
2 |
|
|
|
3 |
root |
1.6 |
# 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 |
root |
1.1 |
umask 022 |
21 |
|
|
|
22 |
|
|
PATH=/root/src/crossfire:$PATH |
23 |
|
|
BASE=/var/www/cfmaps.schmorp.de |
24 |
|
|
export CROSSFIRE_LIBDIR=$BASE/lib |
25 |
|
|
|
26 |
|
|
cd "$BASE" || exit 69 |
27 |
|
|
|
28 |
root |
1.5 |
VERSION=1.01 |
29 |
root |
1.3 |
|
30 |
root |
1.1 |
cvs -Q -z3 update -AdP | grep -v ^\\? |
31 |
|
|
|
32 |
|
|
rm -f .cfmap2html |
33 |
|
|
|
34 |
|
|
find . -name CVS -prune -o -type d -printf "%P/\n" | while read dir; do |
35 |
|
|
( |
36 |
|
|
export dir |
37 |
|
|
cd "./$dir" || exit 68 |
38 |
|
|
{ |
39 |
root |
1.6 |
echo "<html><head><title>Crossfire Maps Directory \"$dir\"</title></head><body><h1>Crossfire Maps Directory \"$dir\"</h1><ul>" >&7 |
40 |
|
|
echo "<li><a href='..'><parent></a></li></ul><h2>This Directory</h2><ul>" >&7 |
41 |
root |
1.1 |
for file in *; do |
42 |
|
|
if [ -f "$file" ]; then |
43 |
|
|
case "$file" in |
44 |
|
|
*.pst | *.jpg | *.png | *.html | *.html.gz | *~ ) |
45 |
|
|
;; |
46 |
|
|
* ) |
47 |
|
|
if head -5 "$file" | grep -q "^arch map"; then |
48 |
|
|
echo "<li><a href='$file.html'>$file</a> [map]</li>" >&7 |
49 |
|
|
DIR="${dir#/}" |
50 |
|
|
echo "$DIR$file" >>$BASE/.cfmap2html |
51 |
|
|
else |
52 |
|
|
echo "<li><a href='$file'>$file</a> [file]</li>" >&7 |
53 |
|
|
fi |
54 |
|
|
;; |
55 |
|
|
esac |
56 |
|
|
elif [ -d "$file" ]; then |
57 |
|
|
case "$file" in |
58 |
|
|
CVS ) |
59 |
|
|
;; |
60 |
|
|
* ) |
61 |
|
|
echo "<li><a href='$file/'>$file/</a> [dir]</li>" >&7 |
62 |
|
|
;; |
63 |
|
|
esac |
64 |
|
|
fi |
65 |
|
|
done |
66 |
root |
1.3 |
echo "</ul>" >&7 |
67 |
|
|
cat <<EOF >&7 |
68 |
|
|
<h2>Bookmarks</h2> |
69 |
|
|
<ul> |
70 |
root |
1.4 |
<li><a href="/world/">Worldmap</a></li> |
71 |
root |
1.3 |
<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 |
83 |
|
|
echo "</body></html>" >&7 |
84 |
root |
1.1 |
} 7>index.html |
85 |
|
|
) |
86 |
|
|
done |
87 |
|
|
|
88 |
|
|
<.cfmap2html xargs cfmap2html |
89 |
root |
1.2 |
rm -f .cfmap2html |
90 |
|
|
|
91 |
|
|
cfarch2html |
92 |
root |
1.3 |
cfworldmap |
93 |
|
|
|
94 |
|
|
chown -R root.root . |
95 |
|
|
chmod -R u=rwX,go=rX . |
96 |
root |
1.2 |
|