diff --git a/getssl b/getssl index f7a58b9..c8dfde7 100755 --- a/getssl +++ b/getssl @@ -269,6 +269,7 @@ # 2021-07-30 Prefer API V2 when both offered (tlhackque) (#690) (2.40) # 2021-07-30 Run tests with -d to catch intermittent failures, Use fork's repo for upgrade tests. (tlhackque) (#692) (2.41) # 2021-08-26 Improve upgrade check & make upgrade do a full install when possible (tlhackque) (#694) (2.42) +# 2021-09-02 Fix version compare - cURL v8 may have single digit minor numbers. (tlhackque) (2.43) # ---------------------------------------------------------------------------------------- case :$SHELLOPTS: in @@ -277,7 +278,7 @@ esac PROGNAME=${0##*/} PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)" -VERSION="2.42" +VERSION="2.43" # defaults ACCOUNT_KEY_LENGTH=4096 @@ -924,6 +925,27 @@ check_getssl_upgrade() { # check if a more recent release is available graceful_exit } +check_version() { # true if version string $1 >= $2 + local v1 v2 i n1 n2 n + # $1 and $2 can be different lengths, but all parts must be numeric + if [[ "$1" == "$2" ]] ; then return 0; fi + local IFS='.' + # shellcheck disable=SC2206 + v1=($1) + # shellcheck disable=SC2206 + v2=($2) + n1="${#v1[@]}" + n2="${#v2[@]}" + if [[ "$n1" -ge "$n2" ]] ; then n="$n1" ; else n="$n2" ; fi + for ((i=0; i