From d730ee831cee33375488ea0117601abd4c7f81da Mon Sep 17 00:00:00 2001 From: Mika Joenpera Date: Wed, 1 Nov 2023 08:04:25 +0200 Subject: [PATCH] Fix review findings in mesh-helper.sh Jira-Id: SCDI-43 Signed-off-by: Mika Joenpera --- common/scripts/mesh-helper.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/scripts/mesh-helper.sh b/common/scripts/mesh-helper.sh index 524cf1f2a..b30b1fe65 100644 --- a/common/scripts/mesh-helper.sh +++ b/common/scripts/mesh-helper.sh @@ -63,14 +63,15 @@ generate_bridge_ip() { source_configuration() { # $1: index of the mesh.conf file to be used + CONFIGURATION_INDEX=$1 - if [ -f "/opt/${1}_mesh.conf" ]; then + if [ -f "/opt/${CONFIGURATION_INDEX}_mesh.conf" ]; then # Calculate hash for mesh.conf file - hash=$(sha256sum /opt/"${1}"_mesh.conf | awk '{print $1}') + hash=$(sha256sum /opt/"${CONFIGURATION_INDEX}"_mesh.conf | awk '{print $1}') # Compare calculated hash with the one created when setting has been applied - if diff <(printf %s "$hash") /opt/"${1}"_mesh.conf_hash; then + if diff <(printf %s "$hash") /opt/"${CONFIGURATION_INDEX}"_mesh.conf_hash; then # shellcheck disable=SC1090 - source /opt/"${1}"_mesh.conf + source /opt/"${CONFIGURATION_INDEX}"_mesh.conf else # Revert to default mesh if [ -f "/opt/mesh_default.conf" ]; then