Add missing version compare function
This commit is contained in:
parent
76c54b4250
commit
07813d0011
|
@ -167,6 +167,31 @@ ${RED}${local_command_available_cmd}${COLOR_DEBUG} is not available on this host
|
||||||
return "${return_command_available}"
|
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() { # {{{
|
main() { # {{{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue