From 2834c06b989cd606bf444868ab823b2673587863 Mon Sep 17 00:00:00 2001 From: thetechprepper Date: Thu, 20 Nov 2025 13:46:46 -0700 Subject: [PATCH] Added initial support for global offline ETC maps. The global zoom is set to 6 due to space constraints --- scripts/download-et-maps.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/download-et-maps.sh b/scripts/download-et-maps.sh index 058f7d6..03ba455 100755 --- a/scripts/download-et-maps.sh +++ b/scripts/download-et-maps.sh @@ -1,31 +1,43 @@ #!/bin/bash # Author : Gaston Gonzalez # Date : 6 July 2025 +# Updated : 20 November 2025 # Purpose : Downloads pre-rendered raster map tiles in mbtile format BASE_URL="https://github.com/thetechprepper/emcomm-tools-os-community/releases/download" RELEASE="emcomm-tools-os-community-20250401-r4-final-4.0.0" TILESET_DIR="/etc/skel/.local/share/emcomm-tools/mbtileserver/tilesets" +# Display names for the menu OPTIONS=( "us" "United States" "ca" "Canada" + "world" "Global Map" ) -SELECTED_COUNTRY=$(dialog --clear --menu "Select a country" 15 40 5 "${OPTIONS[@]}" 2>&1 >/dev/tty) +# Map each option to its corresponding file name +declare -A FILES +FILES=( + ["us"]="osm-us-zoom0to10-20250703.mbtiles" + ["ca"]="osm-ca-zoom0to10-20250703.mbtiles" + ["world"]="osm-world-zoom0to6-20251120.mbtiles" +) + +# Show dialog +SELECTED_COUNTRY=$(dialog --clear --menu "Select a country" 15 40 5 "${OPTIONS[@]}" 2>&1 >/dev/tty) EXIT_STATUS=$? -tput sgr 0 && clear +tput sgr0 && clear if [[ $EXIT_STATUS -eq 0 ]]; then - DOWNLOAD_FILE="osm-${SELECTED_COUNTRY}-zoom0to10-20250703.mbtiles" + DOWNLOAD_FILE="${FILES[$SELECTED_COUNTRY]}" DOWNLOAD_URL="${BASE_URL}/${RELEASE}/${DOWNLOAD_FILE}" if [[ ! -e ${DOWNLOAD_FILE} ]]; then et-log "Downloading ${DOWNLOAD_URL}" - curl -L -f -o ${DOWNLOAD_FILE} ${DOWNLOAD_URL} + curl -L -f -o "${DOWNLOAD_FILE}" "${DOWNLOAD_URL}" fi - et-log "Moving ${DOWNLOAD_FILE} ${TILESET_DIR}" - mv -v ${DOWNLOAD_FILE} ${TILESET_DIR} + et-log "Moving ${DOWNLOAD_FILE} to ${TILESET_DIR}" + mv -v "${DOWNLOAD_FILE}" "${TILESET_DIR}" fi