Skip to content

Commit 418e692

Browse files
author
Rub21
committed
Process db creation one by one
1 parent dfef7e5 commit 418e692

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

images/taginfo/start.sh

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,37 @@ updates_source_code() {
4949
sed -i -e 's/run_ruby "$SRCDIR\/get_icons.rb"/ruby "$SRCDIR\/get_icons.rb"/g' $WORKDIR/taginfo/sources/projects/update.sh
5050
}
5151

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+
5270
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)..."
5472

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
6075

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
6581

66-
updates_create_db "db projects chronology"
82+
updates_create_db $CREATE_DB
6783
$WORKDIR/taginfo/sources/update_all.sh $UPDATE_DIR
6884

6985
# Copy db files into data folder

0 commit comments

Comments
 (0)