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"