From f26e4a62aa5842ca5c27ca2012de499039cf7b66 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt <buttjantarek@googlemail.com> Date: Sat, 19 Sep 2015 14:36:52 +0200 Subject: [PATCH] add overwrite priority for geocoordinates --- .../lib/ffnw/configurator/configurator.sh | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/configurator/files/lib/ffnw/configurator/configurator.sh b/configurator/files/lib/ffnw/configurator/configurator.sh index aa07700..916bba0 100644 --- a/configurator/files/lib/ffnw/configurator/configurator.sh +++ b/configurator/files/lib/ffnw/configurator/configurator.sh @@ -152,16 +152,20 @@ autoadd_ipv6_address() { sync_geo_location(){ if [[ $(awk 'BEGIN{srand();print int(rand()*100)}') -lt 5 ]];then - mac=$(uci get wireless.mesh_radio0.macaddr) - coords="$(wget -q -O - "http://${API_IPV6_ADRESS}/getcoords.php?mac=$mac")" - echo "$coords" | grep "[0-9]\{1,3\}\(\.[0-9]\)* [0-9]\{1,3\}\(\.[0-9]\)*" - if [ "$?" = "0" ]; then - lat="$(echo "$coords" | cut -d'|' -f1)" - lon="$(echo "$coords" | cut -d'|' -f2)" - uci set gluon-node-info.@location[0].latitude=$lat - uci set gluon-node-info.@location[0].longitude=$lon - uci set gluon-node-info.@location[0].share_location=1 - uci commit gluon-node-info.@location[0] + Static_location=$(uci get gluon-node-info.@location[0].static_location) + if [ $Static_location -eq 0 ]; then + mac=$(uci get wireless.mesh_radio0.macaddr) + coords="$(wget -q -O - "http://${API_IPV6_ADRESS}/getcoords.php?mac=$mac")" + echo "$coords" | grep "[0-9]\{1,3\}\(\.[0-9]\)* [0-9]\{1,3\}\(\.[0-9]\)*" + if [ "$?" = "0" ]; then + lat="$(echo "$coords" | cut -d'|' -f1)" + lon="$(echo "$coords" | cut -d'|' -f2)" + uci set gluon-node-info.@location[0].auto_location=0 + uci set gluon-node-info.@location[0].latitude=$lat + uci set gluon-node-info.@location[0].longitude=$lon + uci set gluon-node-info.@location[0].share_location=1 + uci commit gluon-node-info.@location[0] + fi fi fi } -- GitLab