mirror of https://github.com/aredn/aredn.git
moved uci actions and file actions under file exists test (#173)
This commit is contained in:
parent
f1b949134d
commit
7163819bf2
|
@ -1,25 +0,0 @@
|
|||
#! /bin/sh
|
||||
if [ "$(/sbin/uci -q get aredn.\@location[0])" = "" ]; then
|
||||
/sbin/uci -q add aredn location
|
||||
fi
|
||||
|
||||
# read /etc/latlon
|
||||
if [ -f /etc/latlon ]
|
||||
then
|
||||
LAT=$(head -1 /etc/latlon)
|
||||
LON=$(tail -1 /etc/latlon)
|
||||
fi
|
||||
|
||||
if [ -f /etc/gridsquare ]
|
||||
then
|
||||
GRIDSQUARE=$(head -1 /etc/gridsquare)
|
||||
fi
|
||||
|
||||
/sbin/uci -q set aredn.@location[0].lat="$LAT"
|
||||
/sbin/uci -q set aredn.@location[0].lon="$LON"
|
||||
/sbin/uci -q set aredn.@location[0].gridsquare="$GRIDSQUARE"
|
||||
/sbin/uci -q commit aredn
|
||||
|
||||
# remove the /etc/latlon and gridsquare files
|
||||
rm -f /etc/latlon
|
||||
rm -f /etc/gridsquare
|
|
@ -0,0 +1,26 @@
|
|||
#!/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
|
Loading…
Reference in New Issue