|
274 | 274 | # 2021-09-30 better error if curl returns 60 (#709)
|
275 | 275 | # 2021-10-01 Fix -preferred-chain argument (#712)
|
276 | 276 | # 2021-10-01 Show help if no domain specified (#705)(2.44)
|
| 277 | +# 2021-10-08 Extract release tag from release api using awk (fix BSD issues) |
| 278 | +# 2021-10-11 Fix broken upgrade url (#718)(2.45) |
277 | 279 | # ----------------------------------------------------------------------------------------
|
278 | 280 |
|
279 | 281 | case :$SHELLOPTS: in
|
|
282 | 284 |
|
283 | 285 | PROGNAME=${0##*/}
|
284 | 286 | PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
|
285 |
| -VERSION="2.44" |
| 287 | +VERSION="2.45" |
286 | 288 |
|
287 | 289 | # defaults
|
288 | 290 | ACCOUNT_KEY_LENGTH=4096
|
@@ -825,22 +827,38 @@ check_getssl_upgrade() { # check if a more recent release is available
|
825 | 827 | # shellcheck disable=SC2086
|
826 | 828 | debug curl ${_NOMETER:---silent} --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE"
|
827 | 829 | # shellcheck disable=SC2086
|
828 |
| - curl ${_NOMETER:---silent} --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE" |
| 830 | + status=$(curl ${_NOMETER:---silent} -w "%{http_code}" --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE") |
829 | 831 | errcode=$?
|
| 832 | +debug errcode=$errcode |
830 | 833 |
|
831 | 834 | if [[ $errcode -eq 60 ]]; then
|
832 | 835 | error_exit "curl needs updating, your version does not support SNI (multiple SSL domains on a single IP)"
|
833 | 836 | elif [[ $errcode -gt 0 ]]; then
|
834 | 837 | error_exit "curl error downloading release: $errcode"
|
835 | 838 | fi
|
836 | 839 |
|
| 840 | + if [[ $status -ne 200 ]]; then |
| 841 | + error_exit "curl didn't find the updated version of getssl at $CODE_LOCATION" |
| 842 | + fi |
| 843 | + |
837 | 844 | if ! install "$0" "${0}.v${VERSION}"; then
|
838 | 845 | error_exit "problem renaming old version while updating, check permissions"
|
839 | 846 | fi
|
840 | 847 | if ! install -m 700 "$TEMP_UPGRADE_FILE" "$0"; then
|
841 | 848 | error_exit "problem installing new version while updating, check permissions"
|
842 | 849 | fi
|
843 | 850 |
|
| 851 | + check=$(bash "$0" -U -v) |
| 852 | + release_tag_upper=$(echo "$release_tag" | tr "[:lower:]" "[:upper:]") |
| 853 | + if [[ "$check" != "getssl ${release_tag_upper}" ]]; then |
| 854 | + info "problem running new version, rolling back to old version" |
| 855 | + if ! install "${0}.v${VERSION}" "$0"; then |
| 856 | + error_exit "problem rolling back, you'll need to manually check $0 and $0.${VERSION}" |
| 857 | + fi |
| 858 | + error_exit "problem calling new version; output of $TEMP_UPGRADE_FILE -v was \"$check\", expected \"getssl ${release_tag_upper}\"" |
| 859 | + fi |
| 860 | + |
| 861 | + |
844 | 862 | if [[ ${_MUTE} -eq 0 ]]; then
|
845 | 863 | echo "Updated getssl from v${VERSION} to ${release_tag}"
|
846 | 864 | echo "The old version remains as ${0}.v${VERSION} and should be removed"
|
|
0 commit comments