aredn/files/etc/uci-defaults/96_aredn_migrate_latlon

27 lines
801 B
Plaintext
Raw Normal View History

#!/bin/sh
if [ "$(/sbin/uci -c /etc/config.mesh -q get aredn.@location[0])" = "" ]; then
/sbin/uci -c /etc/config.mesh add aredn location
/sbin/uci -c /etc/config.mesh commit aredn
fi
# read /etc/latlon
if [ -f /etc/latlon ]
then
LAT=$(head -1 /etc/latlon)
LON=$(tail -1 /etc/latlon)
/sbin/uci -c /etc/config.mesh -q set aredn.@location[0].lat="$LAT"
/sbin/uci -c /etc/config.mesh -q set aredn.@location[0].lon="$LON"
/sbin/uci -c /etc/config.mesh -q commit aredn
rm -f /etc/latlon
fi
if [ -f /etc/gridsquare ]
then
GRIDSQUARE=$(head -1 /etc/gridsquare)
/sbin/uci -c /etc/config.mesh -q set aredn.@location[0].gridsquare="$GRIDSQUARE"
/sbin/uci -c /etc/config.mesh -q commit aredn
rm -f /etc/gridsquare
fi
cp /etc/config.mesh/aredn /etc/config/aredn