From 774b23f51e455c67bf0458b49eae5101aa12c341 Mon Sep 17 00:00:00 2001 From: petedyerarm Date: Wed, 10 May 2023 17:44:27 +0100 Subject: [PATCH] Simplify edge-info Removed the need for the relaystatics.sh file - the cached values it provided can be easily worked out every time. --- edge-info/edge-info | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/edge-info/edge-info b/edge-info/edge-info index 98b0f50..9e89b70 100755 --- a/edge-info/edge-info +++ b/edge-info/edge-info @@ -46,14 +46,13 @@ _debug(){ fi } -#This bash program is intended to work on multiple build systems. In yocto/linux micro platform (LMP) we set EDGE_DATA at build time to a user variable (default: /var/rootdirs/userdata) using sed. For other build systems, follow that technique OR add on to the following function to detect your system and set RFILE and IFILE to your desired locations. -STORAGE=EDGE_DATA +#This bash program is intended to work on multiple build systems. In yocto/linux micro platform (LMP) we set /userdata at build time to a user variable (default: /var/rootdirs/userdata) using sed. For other build systems, follow that technique OR add on to the following function to detect your system and set IFILE to your desired locations. + +STORAGE=/userdata set_storage_locations(){ if [[ -e "$STORAGE" ]]; then - RFILE="$STORAGE/info/relaystatics.sh" IFILE="$STORAGE/edge_gw_config/identity.json" else - RFILE=/userdata/info/relaystatics.sh IFILE=/userdata/edge_gw_config/identity.json fi if [ -e /edge/mbed/edge-core ]; then @@ -117,10 +116,6 @@ set_machine_vars(){ } load_statistics(){ - if [[ -e "$RFILE" ]]; then - # shellcheck disable=SC1090 - source "$RFILE" - fi EDGECORESTATUS=$(curl -s localhost:9101/status); if [[ $EDGECORESTATUS = "" ]]; then Status="${MAGENTA}offline${NORM}" @@ -140,16 +135,6 @@ load_statistics(){ else Status=$(echo "$EDGECORESTATUS" | jq -r '."status"') fi - if [[ ! -e "$RFILE" && "$URL_gatewayServicesAddress" != "" ]]; then - { - echo "AccountID=\"$AccountID\"" - echo "DID=\"$DID\"" - echo "URL_LWM2Mserver=\"$URL_LWM2Mserver\"" - echo "URL_gatewayServicesAddress=\"$URL_gatewayServicesAddress\"" - echo "URL_edgek8sServicesAddress=\"$URL_edgek8sServicesAddress\"" - echo "URL_containerServicesAddress=\"$URL_containerServicesAddress\"" - } > $RFILE - fi }