2025-07-06 13:47:42 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Author : Gaston Gonzalez
|
|
|
|
|
# Date : 6 July 2025
|
2025-11-21 06:19:47 -07:00
|
|
|
# Updated : 21 November 2025
|
2025-07-06 13:47:42 -07:00
|
|
|
# Purpose : Downloads pre-rendered raster map tiles in mbtile format
|
|
|
|
|
|
|
|
|
|
BASE_URL="https://github.com/thetechprepper/emcomm-tools-os-community/releases/download"
|
2025-11-21 06:19:47 -07:00
|
|
|
RELEASE="emcomm-tools-os-community-20251128-r5-final-5.0.0"
|
2025-07-06 13:47:42 -07:00
|
|
|
TILESET_DIR="/etc/skel/.local/share/emcomm-tools/mbtileserver/tilesets"
|
|
|
|
|
|
2025-11-20 13:46:46 -07:00
|
|
|
# Display names for the menu
|
2025-07-06 13:47:42 -07:00
|
|
|
OPTIONS=(
|
|
|
|
|
"us" "United States"
|
|
|
|
|
"ca" "Canada"
|
2025-11-20 13:46:46 -07:00
|
|
|
"world" "Global Map"
|
2025-07-06 13:47:42 -07:00
|
|
|
)
|
|
|
|
|
|
2025-11-20 13:46:46 -07:00
|
|
|
# Map each option to its corresponding file name
|
|
|
|
|
declare -A FILES
|
|
|
|
|
FILES=(
|
2025-11-20 13:59:49 -07:00
|
|
|
["us"]="osm-us-zoom0to11-20251120.mbtiles"
|
|
|
|
|
["ca"]="osm-ca-zoom0to10-20251120.mbtiles"
|
2025-11-21 06:19:47 -07:00
|
|
|
["world"]="osm-world-zoom0to7-20251121.mbtiles"
|
2025-11-20 13:46:46 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Show dialog
|
2025-11-20 14:04:05 -07:00
|
|
|
SELECTED_COUNTRY=$(dialog --clear --menu "Select a country" 10 40 5 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
2025-07-06 13:47:42 -07:00
|
|
|
EXIT_STATUS=$?
|
|
|
|
|
|
2025-11-20 13:46:46 -07:00
|
|
|
tput sgr0 && clear
|
2025-07-06 13:47:42 -07:00
|
|
|
|
|
|
|
|
if [[ $EXIT_STATUS -eq 0 ]]; then
|
2025-11-20 13:46:46 -07:00
|
|
|
DOWNLOAD_FILE="${FILES[$SELECTED_COUNTRY]}"
|
2025-07-06 13:47:42 -07:00
|
|
|
DOWNLOAD_URL="${BASE_URL}/${RELEASE}/${DOWNLOAD_FILE}"
|
|
|
|
|
|
|
|
|
|
if [[ ! -e ${DOWNLOAD_FILE} ]]; then
|
|
|
|
|
et-log "Downloading ${DOWNLOAD_URL}"
|
2025-11-20 13:46:46 -07:00
|
|
|
curl -L -f -o "${DOWNLOAD_FILE}" "${DOWNLOAD_URL}"
|
2025-07-06 13:47:42 -07:00
|
|
|
fi
|
|
|
|
|
|
2025-11-20 13:46:46 -07:00
|
|
|
et-log "Moving ${DOWNLOAD_FILE} to ${TILESET_DIR}"
|
|
|
|
|
mv -v "${DOWNLOAD_FILE}" "${TILESET_DIR}"
|
2025-07-06 13:47:42 -07:00
|
|
|
fi
|