@@ -49,21 +49,37 @@ updates_source_code() {
49
49
sed -i -e ' s/run_ruby "$SRCDIR\/get_icons.rb"/ruby "$SRCDIR\/get_icons.rb"/g' $WORKDIR /taginfo/sources/projects/update.sh
50
50
}
51
51
52
+ download_planet_files () {
53
+ mkdir -p $UPDATE_DIR /planet/
54
+
55
+ # Check if URL_PLANET_FILE_STATE exist and set URL_PLANET_FILE
56
+ if [[ ${URL_PLANET_FILE_STATE} && ${URL_PLANET_FILE_STATE-x} ]]; then
57
+ URL_PLANET_FILE=$( curl -D -X GET $URL_PLANET_FILE_STATE )
58
+ fi
59
+
60
+ # Check if URL_HISTORY_PLANET_FILE_STATE exist and set URL_HISTORY_PLANET_FILE
61
+ if [[ ${URL_HISTORY_PLANET_FILE_STATE} && ${URL_HISTORY_PLANET_FILE_STATE-x} ]]; then
62
+ URL_HISTORY_PLANET_FILE=$( curl -D -X GET $URL_HISTORY_PLANET_FILE_STATE )
63
+ fi
64
+ # Download pbf files
65
+ wget --no-check-certificate -O $UPDATE_DIR /planet/planet.osm.pbf $URL_PLANET_FILE
66
+ wget --no-check-certificate -O $UPDATE_DIR /planet/history-planet.osh.pbf $URL_HISTORY_PLANET_FILE
67
+
68
+ }
69
+
52
70
update () {
53
- echo " Download and update pbf files at $( date +%Y-%m-%d:%H-%M) ..."
71
+ echo " Update Sqlite DBs at $( date +%Y-%m-%d:%H-%M) ..."
54
72
55
- # Download OSM planet replication and full-history files,
56
- # TODO: Download latest files,comparing with something like md5 decryption
57
- mkdir -p $UPDATE_DIR /planet/
58
- [ ! -f $UPDATE_DIR /planet/planet.osm.pbf ] && wget --no-check-certificate -O $UPDATE_DIR /planet/planet.osm.pbf $URL_PLANET_FILE
59
- [ ! -f $UPDATE_DIR /planet/history-planet.osh.pbf ] && wget --no-check-certificate -O $UPDATE_DIR /planet/history-planet.osh.pbf $URL_HISTORY_PLANET_FILE
73
+ # Download OSM planet replication and full-history files,
74
+ download_planet_files
60
75
61
- # Update local DB,twice, with different parameters,
62
- # in order to make it work we need to pass first "db projects" and then "db projects chronology"
63
- updates_create_db " db projects"
64
- $WORKDIR /taginfo/sources/update_all.sh $UPDATE_DIR
76
+ # In order to make it work we need to pass first one by one the creation and then all of them "db projects chronology"
77
+ for value in $CREATE_DB ; do
78
+ updates_create_db $value
79
+ $WORKDIR /taginfo/sources/update_all.sh $UPDATE_DIR
80
+ done
65
81
66
- updates_create_db " db projects chronology "
82
+ updates_create_db $CREATE_DB
67
83
$WORKDIR /taginfo/sources/update_all.sh $UPDATE_DIR
68
84
69
85
# Copy db files into data folder
0 commit comments