blob: c9fbc400232430f0d59307bdb896f22f455518a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/bin/sh
#------------------------------------------------------------------------------
#
# Taginfo
#
# update_all.sh DIR
#
# Call this to update your Taginfo databases. All data will be store in the
# directory DIR. Create an empty directory before starting for the first time!
#
# In this directory you will find:
# log - directory with log files from running the update script
# download - directory with bzipped databases for download
# ... - a directory for each source with database and possible some
# temporary files
#
#------------------------------------------------------------------------------
# These sources will be downloaded from http://taginfo.openstreetmap.org/download/
# Note that this will NOT work for the "db" source! Well, you can download it,
# but it will fail later, because the database is changed by the master.sql
# scripts.
SOURCES_DOWNLOAD=`../bin/taginfo-config.rb sources.download`
# These sources will be created from the actual sources
SOURCES_CREATE=`../bin/taginfo-config.rb sources.create`
#------------------------------------------------------------------------------
set -e
DATECMD='date +%Y-%m-%dT%H:%M:%S'
DIR=$1
if [ "x" = "x$DIR" ]; then
echo "Usage: update.sh DIR"
exit 1
fi
LOGFILE=`date +%Y%m%dT%H%M`
mkdir -p $DIR/log
exec >$DIR/log/$LOGFILE.log 2>&1
echo "`$DATECMD` Start update_all..."
mkdir -p $DIR/download
for source in $SOURCES_DOWNLOAD; do
echo "====================================="
echo "Downloading $source..."
mkdir -p $DIR/$source
wget --quiet -O $DIR/download/taginfo-$source.db.bz2 http://taginfo.openstreetmap.org/download/taginfo-$source.db.bz2
bzcat $DIR/download/taginfo-$source.db.bz2 >$DIR/$source/taginfo-$source.db
echo "Done."
done
for source in $SOURCES_CREATE; do
echo "====================================="
echo "Running $source/update.sh..."
mkdir -p $DIR/$source
cd $source
./update.sh $DIR/$source
cd ..
echo "Done."
done
echo "====================================="
echo "Running master/update.sh..."
cd master
./update.sh $DIR
cd ..
for source in $SOURCES_CREATE; do
echo "====================================="
echo "Running bzip2 on $source..."
bzip2 -9 -c $DIR/$source/taginfo-$source.db >$DIR/download/taginfo-$source.db.bz2
echo "Done."
done
echo "Running bzip2..."
bzip2 -9 -c $DIR/taginfo-master.db >$DIR/download/taginfo-master.db.bz2
echo "Done."
echo "====================================="
echo "`$DATECMD` Done update_all."
#-- THE END -------------------------------------------------------------------
|