diff --git a/osm-garmin/app/build-gmap.sh b/osm-garmin/app/build-gmap.sh index a6eadaf..bfab15d 100755 --- a/osm-garmin/app/build-gmap.sh +++ b/osm-garmin/app/build-gmap.sh @@ -2,7 +2,7 @@ . /app/utils.sh -region="$1" +regions="$1" style="$2" cwd="$(pwd)" @@ -87,7 +87,7 @@ function update_bounds() { } download_bounds "bounds" - #download_bounds "sea" + download_bounds "sea" } function update_osm_map() { @@ -121,26 +121,35 @@ if [[ -z $region ]]; then die "No region specified" fi -if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then - echo "๐Ÿ‘€ Checking for OSM updates..." - if [[ "$(check_osm_update "$region")" == "true" ]]; then - [[ $? != 0 ]] && die "Region \"$region\" does not exist" +regions_array="$(echo $regions | tr ";" "\n")" - echo "๐ŸŒ Updating OSM map: $region" - update_osm_map "$region" +for region in $regions_array; do + if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then + echo "๐Ÿ‘€ Checking OSM updates: $region" - echo "๐Ÿ“’ Updating bounds and sea..." - update_bounds + if [[ "$(check_osm_update "$region")" == "true" ]]; then + echo "๐ŸŒ Updating OSM map: $region" + update_osm_map "$region" - echo "โœ‚๏ธ Building tiles: $region" - update_tiles "$region" + echo "โœ‚๏ธ Building tiles: $region" + update_tiles "$region" + fi + else + echo "โš ๏ธ Region \"$region\" does not exist" fi +done - echo "๐Ÿ”จ Building Garmin map: $region" - build_gmap "$region" "$style" -else - [[ $? != 0 ]] && die "Region \"$region\" does not exist" -fi +echo "๐Ÿ“’ Updating bounds..." +update_bounds + +for region in $regions_array; do + if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then + echo "๐Ÿ”จ Building Garmin map: $region" + build_gmap "$region" "$style" + else + echo "โš ๏ธ Region \"$region\" does not exist" + fi +done echo "๐Ÿงน Cleaning up..." cleanup \ No newline at end of file diff --git a/osm-garmin/app/daemon.sh b/osm-garmin/app/daemon.sh index 07b2184..407c1c0 100644 --- a/osm-garmin/app/daemon.sh +++ b/osm-garmin/app/daemon.sh @@ -10,15 +10,7 @@ do [[ -n "$OSMGARMIN_REGIONS" ]] && regions="$OSMGARMIN_REGIONS" [[ -n "$OSMGARMIN_STYLE" ]] && style="$OSMGARMIN_STYLE" - regions_array="$(echo $regions | tr ";" "\n")" - - for region in $regions_array; do - if [[ "$(check_osm_update "$region")" == "true" ]]; then - /app/build-gmap.sh "$region" "$style" - # TODO: Tear this apart so we can update the maps and bounds separately, - # then build all the maps afterwards (less wasteful!) - fi - done + /app/build-gmap.sh "$regions" "$style" sleep 3600 done \ No newline at end of file