From 2a69c977c9c2566fdf6fa1bf822eed006741052b Mon Sep 17 00:00:00 2001 From: Volker von Hoesslin Date: Fri, 14 Feb 2020 11:59:27 +0100 Subject: [PATCH 1/3] allow external PBF file with auto-downloader --- run.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/run.sh b/run.sh index ab7d659..7d3faeb 100755 --- a/run.sh +++ b/run.sh @@ -36,11 +36,20 @@ if [ "$1" = "import" ]; then setPostgresPassword # Download Luxembourg as sample if no data is provided - if [ ! -f /data.osm.pbf ]; then - echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..." - wget -nv http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf -O /data.osm.pbf - wget -nv http://download.geofabrik.de/europe/luxembourg.poly -O /data.poly + if [ ! -f /data.osm.pbf && ! -z "$(DL_PBF)" ]; then + echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..." + DL_PBF="http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf" + DL_PBF_POLY="http://download.geofabrik.de/europe/luxembourg.poly" fi + + if [ -z "$(DL_PBF)" ]; then + echo "INFO: Download PBF file: $DL_PBF" + wget -nv "$(DL_PBF)" -O /data.osm.pbf + if [ -z "$(DL_PBF_POLY)" ]; then + echo "INFO: Download PBF-POLY file: $(DL_PBF_POLY)" + wget -nv "$(DL_PBF_POLY)" -O /data.poly + fi + fi if [ "$UPDATES" = "enabled" ]; then # determine and set osmosis_replication_timestamp (for consecutive updates) From 6d0e8070f57ded438797ed4482cb76a3ffc5faf4 Mon Sep 17 00:00:00 2001 From: Volker von Hoesslin Date: Wed, 19 Feb 2020 12:01:17 +0100 Subject: [PATCH 2/3] fix bash syntax --- run.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index 7d3faeb..e27f064 100755 --- a/run.sh +++ b/run.sh @@ -36,18 +36,18 @@ if [ "$1" = "import" ]; then setPostgresPassword # Download Luxembourg as sample if no data is provided - if [ ! -f /data.osm.pbf && ! -z "$(DL_PBF)" ]; then + if [ ! -f /data.osm.pbf ] && [ -z "$DL_PBF" ]; then echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..." DL_PBF="http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf" DL_PBF_POLY="http://download.geofabrik.de/europe/luxembourg.poly" fi - if [ -z "$(DL_PBF)" ]; then + if [ -n "$DL_PBF" ]; then echo "INFO: Download PBF file: $DL_PBF" - wget -nv "$(DL_PBF)" -O /data.osm.pbf - if [ -z "$(DL_PBF_POLY)" ]; then - echo "INFO: Download PBF-POLY file: $(DL_PBF_POLY)" - wget -nv "$(DL_PBF_POLY)" -O /data.poly + wget -nv "$DL_PBF" -O /data.osm.pbf + if [ -n "$DL_PBF_POLY" ]; then + echo "INFO: Download PBF-POLY file: $DL_PBF_POLY" + wget -nv "$DL_PBF_POLY" -O /data.poly fi fi From 83f26e1abec42fa5ddd98db0c66b6476c0522102 Mon Sep 17 00:00:00 2001 From: Volker von Hoesslin Date: Thu, 20 Feb 2020 08:46:46 +0100 Subject: [PATCH 3/3] fix indent --- run.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/run.sh b/run.sh index e27f064..53ee429 100755 --- a/run.sh +++ b/run.sh @@ -37,19 +37,19 @@ if [ "$1" = "import" ]; then # Download Luxembourg as sample if no data is provided if [ ! -f /data.osm.pbf ] && [ -z "$DL_PBF" ]; then - echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..." - DL_PBF="http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf" - DL_PBF_POLY="http://download.geofabrik.de/europe/luxembourg.poly" + echo "WARNING: No import file at /data.osm.pbf, so importing Luxembourg as example..." + DL_PBF="http://download.geofabrik.de/europe/luxembourg-latest.osm.pbf" + DL_PBF_POLY="http://download.geofabrik.de/europe/luxembourg.poly" + fi + + if [ -n "$DL_PBF" ]; then + echo "INFO: Download PBF file: $DL_PBF" + wget -nv "$DL_PBF" -O /data.osm.pbf + if [ -n "$DL_PBF_POLY" ]; then + echo "INFO: Download PBF-POLY file: $DL_PBF_POLY" + wget -nv "$DL_PBF_POLY" -O /data.poly + fi fi - - if [ -n "$DL_PBF" ]; then - echo "INFO: Download PBF file: $DL_PBF" - wget -nv "$DL_PBF" -O /data.osm.pbf - if [ -n "$DL_PBF_POLY" ]; then - echo "INFO: Download PBF-POLY file: $DL_PBF_POLY" - wget -nv "$DL_PBF_POLY" -O /data.poly - fi - fi if [ "$UPDATES" = "enabled" ]; then # determine and set osmosis_replication_timestamp (for consecutive updates)