|
269 | 269 | # 2021-07-30 Prefer API V2 when both offered (tlhackque) (#690) (2.40)
|
270 | 270 | # 2021-07-30 Run tests with -d to catch intermittent failures, Use fork's repo for upgrade tests. (tlhackque) (#692) (2.41)
|
271 | 271 | # 2021-08-26 Improve upgrade check & make upgrade do a full install when possible (tlhackque) (#694) (2.42)
|
| 272 | +# 2021-09-02 Fix version compare - cURL v8 may have single digit minor numbers. (tlhackque) (2.43) |
272 | 273 | # ----------------------------------------------------------------------------------------
|
273 | 274 |
|
274 | 275 | case :$SHELLOPTS: in
|
|
277 | 278 |
|
278 | 279 | PROGNAME=${0##*/}
|
279 | 280 | PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
|
280 |
| -VERSION="2.42" |
| 281 | +VERSION="2.43" |
281 | 282 |
|
282 | 283 | # defaults
|
283 | 284 | ACCOUNT_KEY_LENGTH=4096
|
@@ -924,6 +925,27 @@ check_getssl_upgrade() { # check if a more recent release is available
|
924 | 925 | graceful_exit
|
925 | 926 | }
|
926 | 927 |
|
| 928 | +check_version() { # true if version string $1 >= $2 |
| 929 | + local v1 v2 i n1 n2 n |
| 930 | + # $1 and $2 can be different lengths, but all parts must be numeric |
| 931 | + if [[ "$1" == "$2" ]] ; then return 0; fi |
| 932 | + local IFS='.' |
| 933 | + # shellcheck disable=SC2206 |
| 934 | + v1=($1) |
| 935 | + # shellcheck disable=SC2206 |
| 936 | + v2=($2) |
| 937 | + n1="${#v1[@]}" |
| 938 | + n2="${#v2[@]}" |
| 939 | + if [[ "$n1" -ge "$n2" ]] ; then n="$n1" ; else n="$n2" ; fi |
| 940 | + for ((i=0; i<n; i++)) do |
| 941 | + n1="${v1[$i]:-0}" |
| 942 | + n2="${v2[$i]:-0}" |
| 943 | + if [[ $((10#$n1)) -gt $((10#$n2)) ]] ; then return 0 ; fi |
| 944 | + if [[ $((10#$n1)) -lt $((10#$n2)) ]] ; then return 1 ; fi |
| 945 | + done |
| 946 | + return 0 |
| 947 | +} |
| 948 | + |
927 | 949 | clean_up() { # Perform pre-exit housekeeping
|
928 | 950 | umask "$ORIG_UMASK"
|
929 | 951 | if [[ $VALIDATE_VIA_DNS == "true" ]]; then
|
@@ -2346,8 +2368,7 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
|
2346 | 2368 | dp="$TEMP_DIR/curl.dump"
|
2347 | 2369 |
|
2348 | 2370 | CURL="curl ${_NOMETER} "
|
2349 |
| - # shellcheck disable=SC2072 |
2350 |
| - if [[ ! "${_CURL_VERSION}" < "7.33" ]]; then |
| 2371 | + if check_version "${_CURL_VERSION}" "7.33" ; then |
2351 | 2372 | CURL="$CURL --http1.1 "
|
2352 | 2373 | fi
|
2353 | 2374 |
|
@@ -2846,8 +2867,7 @@ requires mktemp
|
2846 | 2867 | # This would help with debugging transfer errors.
|
2847 | 2868 |
|
2848 | 2869 | _CURL_VERSION="$(curl -V | head -1 | cut -d' ' -f2 )"
|
2849 |
| -# shellcheck disable=SC2072 |
2850 |
| -if [[ ! "${_CURL_VERSION}" < "7.67" ]]; then |
| 2870 | +if check_version "${_CURL_VERSION}" "7.67" ; then |
2851 | 2871 | _NOMETER="--no-progress-meter"
|
2852 | 2872 | fi
|
2853 | 2873 |
|
|
0 commit comments