aredn/files/etc/uci-defaults/98_change_default_maptiles

13 lines
708 B
Bash
Executable File

#!/bin/sh
#check for old default map tiles and change to the new map tiles if req'd
#will not change existing custom entries.
OLDTILES_1='http://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiazVkbHEiLCJhIjoiY2lqMnlieTM4MDAyNXUwa3A2eHMxdXE3MiJ9.BRFvx4q2vi70z5Uu2zRYQw'
OLDTILES_2='http://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg'
NEWTILES='http://tile.openstreetmap.org/{z}/{x}/{y}.png'
MAPTILESERVER=$(/sbin/uci -c /etc/config.mesh get aredn.@map[0].maptiles)
if [ "$MAPTILESERVER" = "$OLDTILES_1" -o "$MAPTILESERVER" = "$OLDTILES_2" ]; then
/sbin/uci -c /etc/config.mesh set aredn.@map[0].maptiles="$NEWTILES"
/sbin/uci -c /etc/config.mesh commit aredn
fi
exit 0