| 1 |
root |
1.1 |
#!/bin/bash |
| 2 |
|
|
|
| 3 |
root |
1.30 |
# cfupdate - convert a deliantra maps hierarchy to html |
| 4 |
|
|
# Copyright (C) 2005,2007,2008 Marc Lehmann <cfmaps@schmorp.de> |
| 5 |
root |
1.6 |
# |
| 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 |
root |
1.24 |
# along with cfmaps; if not, write to the Free Software |
| 18 |
root |
1.6 |
# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
|
|
|
| 20 |
root |
1.40 |
VERSION=2.033 |
| 21 |
root |
1.7 |
|
| 22 |
root |
1.1 |
umask 022 |
| 23 |
|
|
|
| 24 |
root |
1.19 |
SRC=/root/src/cfmaps |
| 25 |
root |
1.9 |
PATH="$SRC:$PATH" |
| 26 |
root |
1.33 |
export BASE=${BASE:-/var/www/maps.deliantra.net} |
| 27 |
|
|
export DELIANTRA_LIBDIR=${DELIANTRA_LIBDIR:-$BASE/lib} |
| 28 |
root |
1.1 |
|
| 29 |
|
|
cd "$BASE" || exit 69 |
| 30 |
|
|
|
| 31 |
root |
1.20 |
#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 |
| 38 |
root |
1.16 |
|
| 39 |
root |
1.1 |
rm -f .cfmap2html |
| 40 |
|
|
|
| 41 |
root |
1.10 |
chmod 644 "$SRC"/*.css |
| 42 |
|
|
cp "$SRC"/*.css . |
| 43 |
root |
1.14 |
chmod 755 "$SRC"/cfmapidx |
| 44 |
|
|
cp "$SRC"/cfmapidx . |
| 45 |
root |
1.9 |
|
| 46 |
root |
1.40 |
find . "(" -name CVS -o -path ./a -o -name .svn ")" -prune -o -type d -printf "%P/\n" | while read dir; do |
| 47 |
root |
1.1 |
( |
| 48 |
|
|
export dir |
| 49 |
|
|
cd "./$dir" || exit 68 |
| 50 |
|
|
{ |
| 51 |
root |
1.9 |
cat >&7 <<-EOF |
| 52 |
|
|
<?xml version='1.0' encoding='utf-8'?> |
| 53 |
root |
1.32 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 54 |
root |
1.9 |
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'> |
| 55 |
|
|
<head> |
| 56 |
root |
1.29 |
<title>Deliantra Maps Directory "$dir"</title> |
| 57 |
root |
1.9 |
<link rel='stylesheet' type='text/css' media='all' href='/common.css'/> |
| 58 |
|
|
</head> |
| 59 |
root |
1.14 |
<body> |
| 60 |
|
|
<p>Keyword Search Over All Maps</p> |
| 61 |
root |
1.32 |
<form action='/search'><p> |
| 62 |
root |
1.14 |
<input type='text' name='k'/> |
| 63 |
|
|
<input type='submit'/> |
| 64 |
root |
1.32 |
</p></form> |
| 65 |
root |
1.29 |
<h1>Deliantra Maps Directory "$dir"</h1><ul> |
| 66 |
root |
1.9 |
<li><a href='..'><parent></a></li></ul><h2>This Directory</h2><ul> |
| 67 |
|
|
EOF |
| 68 |
root |
1.1 |
for file in *; do |
| 69 |
root |
1.33 |
if [ -h "$file" ]; then |
| 70 |
|
|
: # ignore for now |
| 71 |
|
|
elif [ -f "$file" ]; then |
| 72 |
root |
1.1 |
case "$file" in |
| 73 |
root |
1.41 |
cfmapidx | *.jpg | *.png | *.xhtml | *.xhtml.gz | *.css | *.err | *~ ) |
| 74 |
root |
1.1 |
;; |
| 75 |
root |
1.27 |
*.map ) |
| 76 |
root |
1.38 |
echo >&7 "<li><a href='${file%.map}.xhtml'>${file%.map}</a> [map] <img class='mapthumb' src='${file%.map}.jpg' /></li>" |
| 77 |
root |
1.27 |
DIR="${dir#/}" |
| 78 |
|
|
echo "$DIR$file" >>$BASE/.cfmap2html |
| 79 |
|
|
;; |
| 80 |
root |
1.1 |
* ) |
| 81 |
root |
1.33 |
# non-deliantra compatibility |
| 82 |
|
|
if [ "$(head -1 "$file")" = "arch map" ]; then |
| 83 |
root |
1.38 |
echo >&7 "<li><a href='$file.xhtml'>$file</a> [map] <img class='mapthumb' src='$file.jpg' /></li>" |
| 84 |
root |
1.33 |
ln -sf "$file" "$file.map" |
| 85 |
|
|
DIR="${dir#/}" |
| 86 |
|
|
echo "$DIR$file.map" >>$BASE/.cfmap2html |
| 87 |
|
|
else |
| 88 |
|
|
echo >&7 "<li><a href='$file'>$file</a> [file]</li>" |
| 89 |
|
|
fi |
| 90 |
root |
1.1 |
;; |
| 91 |
|
|
esac |
| 92 |
|
|
elif [ -d "$file" ]; then |
| 93 |
|
|
case "$file" in |
| 94 |
|
|
CVS ) |
| 95 |
|
|
;; |
| 96 |
|
|
* ) |
| 97 |
root |
1.8 |
echo >&7 "<li><a href='$file/'>$file/</a> [dir]</li>" |
| 98 |
root |
1.1 |
;; |
| 99 |
|
|
esac |
| 100 |
|
|
fi |
| 101 |
|
|
done |
| 102 |
root |
1.8 |
echo >&7 "</ul>" |
| 103 |
root |
1.9 |
cat >&7 <<-EOF |
| 104 |
|
|
<h2>Bookmarks</h2> |
| 105 |
|
|
<ul> |
| 106 |
|
|
<li><a href="/world/">Worldmap</a></li> |
| 107 |
|
|
<li><a href="/world/world_105_115.xhtml">Scorn</a></li> |
| 108 |
|
|
<li><a href="/world/world_102_108.xhtml">Santo Dominion</a></li> |
| 109 |
|
|
<li><a href="/world/world_107_123.xhtml">Brest</a></li> |
| 110 |
|
|
<li><a href="/world/world_109_126.xhtml">Lake Country</a></li> |
| 111 |
|
|
<li><a href="/world/world_122_117.xhtml">Navar</a></li> |
| 112 |
|
|
<li><a href="/world/world_116_102.xhtml">Darcap</a></li> |
| 113 |
|
|
<li><a href="/world/world_128_109.xhtml">Wolfsburg</a></li> |
| 114 |
|
|
<li><a href="/world/world_128_101.xhtml">Azumauindo</a></li> |
| 115 |
|
|
</ul> |
| 116 |
root |
1.21 |
<p class="footer">created by <a href='http://software.schmorp.de/pkg/cfmaps'>cfupdate</a> version $VERSION</p> |
| 117 |
root |
1.9 |
EOF |
| 118 |
root |
1.8 |
echo >&7 "</body></html>" |
| 119 |
root |
1.20 |
} 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 |
| 126 |
root |
1.13 |
#gzip -7f index.xhtml |
| 127 |
root |
1.1 |
) |
| 128 |
|
|
done |
| 129 |
|
|
|
| 130 |
root |
1.33 |
for dir in *; do |
| 131 |
root |
1.34 |
if [ -e "$dir/${dir}_123_107.map" ]; then |
| 132 |
root |
1.33 |
cfworldmap "$dir" |
| 133 |
|
|
fi |
| 134 |
|
|
done |
| 135 |
|
|
|
| 136 |
root |
1.29 |
cfarch2html |
| 137 |
|
|
|
| 138 |
root |
1.37 |
rm -f .index.dat~ |
| 139 |
root |
1.41 |
<.cfmap2html xargs -l90 cfmap2html |
| 140 |
|
|
<.cfmap2html xargs -l50 cfmapidx -a |
| 141 |
|
|
cfmapidx -a -r # reorganise |
| 142 |
root |
1.37 |
mv .index.dat~ .index.dat |
| 143 |
root |
1.12 |
|
| 144 |
root |
1.42 |
rm -f .cfmap2html |
| 145 |
root |
1.2 |
|
| 146 |
root |
1.3 |
chown -R root.root . |
| 147 |
|
|
chmod -R u=rwX,go=rX . |
| 148 |
root |
1.2 |
|