-
Notifications
You must be signed in to change notification settings - Fork 92
/
update.sh
executable file
·55 lines (41 loc) · 1.44 KB
/
update.sh
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
#!/usr/bin/env bash
#------------------------------------------------------------------------------
#
# Taginfo source: Chronology
#
# update.sh DATADIR [OSM_HISTORY_FILE]
#
#------------------------------------------------------------------------------
set -euo pipefail
readonly SRCDIR=$(dirname $(readlink -f "$0"))
readonly DATADIR=$1
if [ -z $DATADIR ]; then
echo "Usage: update.sh DATADIR [OSM_HISTORY_FILE]"
exit 1
fi
readonly DATABASE=$DATADIR/taginfo-chronology.db
readonly SELECTION_DB=$DATADIR/../selection.db
source $SRCDIR/../util.sh chronology
readonly OSM_HISTORY_FILE=${2:-$(get_config sources.chronology.osm_history_file)}
run_chronology() {
local cmd=$(get_bindir)/taginfo-chronology
local open_selection_db=""
if [[ -f $SELECTION_DB && -s $SELECTION_DB ]]; then
open_selection_db="--selection-db=$SELECTION_DB"
print_message "Reading selection database '$SELECTION_DB'"
else
print_message "Selection database '$SELECTION_DB' not found. Not creating some statistics."
print_message " The next taginfo update should automatically correct this."
fi
print_message "Running taginfo-chronology... "
run_exe $cmd $open_selection_db $OSM_HISTORY_FILE $DATABASE
}
main() {
print_message "Start chronology..."
rm -f $DATABASE
initialize_database $DATABASE $SRCDIR
run_chronology
finalize_database $DATABASE $SRCDIR
print_message "Done chronology."
}
main