From 3e5e7912ca8bd92829cbd961fa1c748a1aa76d33 Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Thu, 9 Nov 2023 23:15:32 +1100 Subject: [PATCH 1/4] fix: use PLATFORM_VERSION variable Signed-off-by: Lenin Mehedy --- dev/scripts/helper.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dev/scripts/helper.sh b/dev/scripts/helper.sh index 4527cacb8..890ffcbdb 100755 --- a/dev/scripts/helper.sh +++ b/dev/scripts/helper.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +source "${CUR_DIR}/env.sh" + start_time=$(date +%s) TMP_DIR="${SCRIPT_DIR}/../temp" @@ -342,7 +345,7 @@ function prep_address_book() { local external_ip="${SVC_IP}" # for v.40.* onward - if [[ "${PLATFORM_PROFILE}" == v0.4* ]]; then + if [[ "${PLATFORM_VERSION}" == v0.4* ]]; then local node_nick_name="${node_name}" config_lines+=("address, ${node_seq}, ${node_nick_name}, ${node_name}, ${node_stake}, ${internal_ip}, ${internal_port}, ${external_ip}, ${external_port}, ${account}") else @@ -355,7 +358,9 @@ function prep_address_book() { done # for v.41.* onward - # config_lines+=("nextNodeId, ${node_seq}") + if [[ "${PLATFORM_VERSION}" == v0.4* ]]; then + config_lines+=("nextNodeId, ${node_seq}") + fi # write contents to config file cp "${SCRIPT_DIR}/../local-node/config.template" "${config_file}" || return "${EX_ERR}" From 195510f4b2fb587d9e75eb6345c78d8db85041d4 Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Fri, 10 Nov 2023 00:03:10 +1100 Subject: [PATCH 2/4] fix: corrected generation of config.txt for v0.41 onward Signed-off-by: Lenin Mehedy --- dev/scripts/helper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/scripts/helper.sh b/dev/scripts/helper.sh index 890ffcbdb..d27fc28dc 100755 --- a/dev/scripts/helper.sh +++ b/dev/scripts/helper.sh @@ -358,7 +358,7 @@ function prep_address_book() { done # for v.41.* onward - if [[ "${PLATFORM_VERSION}" == v0.4* ]]; then + if [[ "${PLATFORM_VERSION}" == v0.41* ]]; then config_lines+=("nextNodeId, ${node_seq}") fi From ce09abc4a89044487e514eb5ba1ac90cd5e7330a Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Mon, 13 Nov 2023 15:01:54 +1100 Subject: [PATCH 3/4] fix: use minor version check Signed-off-by: Lenin Mehedy --- dev/scripts/helper.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dev/scripts/helper.sh b/dev/scripts/helper.sh index d27fc28dc..cb1ffe455 100755 --- a/dev/scripts/helper.sh +++ b/dev/scripts/helper.sh @@ -289,6 +289,11 @@ function prep_address_book() { echo "Preparing address book" echo "-----------------------------------------------------------------------------------------------------" + IFS=. read -a VERSION_PARTS <<< "$PLATFORM_VERSION" + echo "MAJOR: ${VERSION_PARTS[0]}, MINOR=${VERSION_PARTS[1]}, PATCH=${VERSION_PARTS[2]}" + local MINOR_VERSION=${VERSION_PARTS[1]} + + local config_file="${TMP_DIR}/config.txt" local node_IP="" local node_seq="${NODE_SEQ:-0}" # this also used as the account ID suffix @@ -345,7 +350,7 @@ function prep_address_book() { local external_ip="${SVC_IP}" # for v.40.* onward - if [[ "${PLATFORM_VERSION}" == v0.4* ]]; then + if [[ "${MINOR_VERSION}" -ge "40" ]]; then local node_nick_name="${node_name}" config_lines+=("address, ${node_seq}, ${node_nick_name}, ${node_name}, ${node_stake}, ${internal_ip}, ${internal_port}, ${external_ip}, ${external_port}, ${account}") else @@ -358,7 +363,7 @@ function prep_address_book() { done # for v.41.* onward - if [[ "${PLATFORM_VERSION}" == v0.41* ]]; then + if [[ "${MINOR_VERSION}" -ge "41" ]]; then config_lines+=("nextNodeId, ${node_seq}") fi From 7164af3676646b8227ff4b1e819cef25891ba721 Mon Sep 17 00:00:00 2001 From: Lenin Mehedy Date: Mon, 13 Nov 2023 15:14:49 +1100 Subject: [PATCH 4/4] fix: polish up debug messages Signed-off-by: Lenin Mehedy --- dev/scripts/helper.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/scripts/helper.sh b/dev/scripts/helper.sh index cb1ffe455..1478bf194 100755 --- a/dev/scripts/helper.sh +++ b/dev/scripts/helper.sh @@ -285,13 +285,14 @@ function copy_node_keys() { # prepare address book using all nodes pod IP and store as config.txt function prep_address_book() { + IFS=. read -a VERSION_PARTS <<< "$PLATFORM_VERSION" + local MINOR_VERSION=${VERSION_PARTS[1]} + echo "" echo "Preparing address book" + echo "PLATFORM_VERSION [ MAJOR: ${VERSION_PARTS[0]}, MINOR=${VERSION_PARTS[1]}, PATCH=${VERSION_PARTS[2]} ]" echo "-----------------------------------------------------------------------------------------------------" - IFS=. read -a VERSION_PARTS <<< "$PLATFORM_VERSION" - echo "MAJOR: ${VERSION_PARTS[0]}, MINOR=${VERSION_PARTS[1]}, PATCH=${VERSION_PARTS[2]}" - local MINOR_VERSION=${VERSION_PARTS[1]} local config_file="${TMP_DIR}/config.txt"