From 07813d00119fa9e4f9cd10a7c6b5871bc75a7fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 30 Jan 2023 17:33:55 +0100 Subject: [PATCH] Add missing version compare function --- ur/fortinet.vpn.v7.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ur/fortinet.vpn.v7.sh b/ur/fortinet.vpn.v7.sh index 60578ec..4d449de 100755 --- a/ur/fortinet.vpn.v7.sh +++ b/ur/fortinet.vpn.v7.sh @@ -167,6 +167,31 @@ ${RED}${local_command_available_cmd}${COLOR_DEBUG} is not available on this host return "${return_command_available}" } # }}} +is_version_greater_than() { # {{{ + + first_value="${1}" + value_to_compare="${2}" + + ## Return False by default + return_is_version_greater_than="1" + + debug_message "is_version_greater_than − \ +Is first value (${first_value}) greater than the second value (${value_to_compare})." + + if printf '%s\n' "${first_value}" "${value_to_compare}" | sort --check=quiet --version-sort; then + debug_message "is_version_greater_than − ${first_value} <= ${value_to_compare} ." + return_is_version_greater_than="1" + else + debug_message "is_version_greater_than − ${first_value} > ${value_to_compare} ." + return_is_version_greater_than="0" + fi + + unset first_value + unset value_to_compare + + return "${return_is_version_greater_than}" +} +# }}} main() { # {{{