Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

fetch-latest-usual-maps.sh (Source)

#!/bin/sh
# Startdate: 2026-03-16-2 11:18
# Purpose: Download all the usual maps for CoMaps local mirror
# Documentation: comaps-README.md
#    I rate-limit to be nice, but it is a CDN so it probably doesn't matter.
# Alternatives:
#    rsync? Not sure if allowed
# code will be in YYMMDD format.
code="${CODE:-$( date -d "$( curl https://f-droid.org/en/packages/app.comaps.fdroid/ | grep -o -iE 'openstreetmap data as of \w+ \w+' | awk '{print $(NF-1),$NF}' )" "+%g%m%d" )}"
td="/mnt/mirror/comaps/maps/${code}"
mkdir -p "${td}" ; cd "${td}"
echo "Using path ${td}"
for word in "World" "WorldCoasts" \
    "US_Maryland_Baltimore" \
; # additional maps above
do
    wget --limit-rate=1.1M --continue "https://cdn-fi-1.comaps.app/maps/${code}/${word}.mwm"
done