From bd59fa38d8e5f9a14e3efbc85353284f7e70b252 Mon Sep 17 00:00:00 2001 From: Ducky Date: Sun, 1 Oct 2023 00:47:04 +0100 Subject: [PATCH] osm-garmin: various --- osm-garmin/app/build-gmap.sh | 35 +++++++++++++++++++++-------------- osm-garmin/app/daemon.sh | 1 + 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/osm-garmin/app/build-gmap.sh b/osm-garmin/app/build-gmap.sh index 82dfc2e..a1de035 100755 --- a/osm-garmin/app/build-gmap.sh +++ b/osm-garmin/app/build-gmap.sh @@ -23,10 +23,6 @@ function build_gmap() { build="true" build_failed="false" - if [[ -n "$style" ]]; then - style="$styles_dir/$style.TYP" - fi - mkdir -p "$generated_map_dir" if [[ -f "$version_path" ]]; then @@ -44,7 +40,8 @@ function build_gmap() { --gmapsupp \ --index \ --route \ - $tiles_dir/$region_shortname/6324*.osm.pbf $style + $tiles_dir/$region_shortname/6324*.osm.pbf \ + "$styles_dir/$style.TYP" [[ $? != 0 ]] && build_failed="true" cd "$cwd" @@ -118,6 +115,9 @@ mkdir -p "$out_dir" mkdir -p "$tiles_dir" regions_array="$(echo $regions | tr ";" "\n")" +is_updates="false" + +[[ $OSMGARMIN_FORCE_BUILD == "true" ]] && is_updates="true" for region in $regions_array; do if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then @@ -127,22 +127,29 @@ for region in $regions_array; do echo "✂️ Building tiles: $region" update_tiles "$region" + + [[ $is_updates == "false" ]] && is_updates="true" + else + echo "⚠️ No updates to \"$region\"" fi else echo "⚠️ Region \"$region\" does not exist" fi done -# TODO: Don't update this if there wasn't any updates -echo "📒 Updating bounds..." -update_bounds +if [[ $is_updates == "true" ]]; then + 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" - fi -done + for region in $regions_array; do + if [[ "$(check_osm_region_exists "$region")" == "true" ]]; then + echo "🔨 Building Garmin map: $region" + build_gmap "$region" "$style" + fi + done +else + echo "⚠️ No new maps. Not building (set $$OSMGARMIN_FORCE_BUILD=true to override)" +fi 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 0f4b669..7169249 100644 --- a/osm-garmin/app/daemon.sh +++ b/osm-garmin/app/daemon.sh @@ -15,6 +15,7 @@ while : do regions="europe/great-britain" style="" + first_run="true" [[ -n "$OSMGARMIN_REGIONS" ]] && regions="$OSMGARMIN_REGIONS" [[ -n "$OSMGARMIN_STYLE" ]] && style="$OSMGARMIN_STYLE"