moved uci actions and file actions under file exists test (#173)

This commit is contained in:
dman776 2021-11-12 08:34:31 -06:00 committed by GitHub
parent f1b949134d
commit 7163819bf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 25 deletions

View File

@ -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

View File

@ -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