From 8dc9a6cbe1c761f4c6bcbf1107ca374346ca7112 Mon Sep 17 00:00:00 2001 From: "Illuminatus [CCIO]" Date: Wed, 7 Aug 2024 16:21:32 -0700 Subject: [PATCH] fixup! Provide a way to support checking compatible version of mithril and node binaries. --- scripts/cnode-helper-scripts/mithril.library | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/cnode-helper-scripts/mithril.library b/scripts/cnode-helper-scripts/mithril.library index abb3c174d..fe03ca8dd 100644 --- a/scripts/cnode-helper-scripts/mithril.library +++ b/scripts/cnode-helper-scripts/mithril.library @@ -128,7 +128,7 @@ read_optional_ips_from_input() { semantic_version_compare () { if [[ "${1}" == "${2}" ]] then - return 0 + echo 0 fi local IFS=. local i semantic_version1=($1) semantic_version2=($2) @@ -141,14 +141,14 @@ semantic_version_compare () { do if ((10#${semantic_version1[i]:=0} > 10#${semantic_version2[i]:=0})) then - return 1 + echo 1 fi if ((10#${semantic_version1[i]} < 10#${semantic_version2[i]})) then - return 2 + echo 2 fi done - return 0 + echo 0 } set_defaults() { @@ -198,8 +198,8 @@ check_mithril_upgrade_safe() { # Debug output echo "DEBUG: MITHRIL_MINIMUM_NODE_VERSION=${MITHRIL_MINIMUM_NODE_VERSION}" - semantic_version_compare "${NODE_CURRENT_VERSION}" "${MITHRIL_MINIMUM_NODE_VERSION}" - if [[ $? -lt 2 ]]; then + RC=$(semantic_version_compare "${NODE_CURRENT_VERSION}" "${MITHRIL_MINIMUM_NODE_VERSION}") + if [[ "${RC}" -lt 2 ]]; then # Node version is greater than or equal to the minimum required version for latest mithril release # Set MITHRIL_UPGRADE_SAFE to Y to allow mithril upgrade by scripts MITHRIL_UPGRADE_SAFE="Y"