Browse Source

Fix broken upgrade url

Add pre and post upgrade sanity checks
Fixes #718
pull/719/head
Tim Kimber 4 years ago
parent
commit
07b5b6e4da
No known key found for this signature in database GPG Key ID: 3E1804964E76BD18
1 changed files with 20 additions and 2 deletions
  1. +20
    -2
      getssl

+ 20
- 2
getssl View File

@ -274,6 +274,8 @@
# 2021-09-30 better error if curl returns 60 (#709)
# 2021-10-01 Fix -preferred-chain argument (#712)
# 2021-10-01 Show help if no domain specified (#705)(2.44)
# 2021-10-08 Extract release tag from release api using awk (fix BSD issues)
# 2021-10-11 Fix broken upgrade url (#718)(2.45)
# ----------------------------------------------------------------------------------------
case :$SHELLOPTS: in
@ -282,7 +284,7 @@ esac
PROGNAME=${0##*/}
PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
VERSION="2.44"
VERSION="2.45"
# defaults
ACCOUNT_KEY_LENGTH=4096
@ -825,8 +827,9 @@ check_getssl_upgrade() { # check if a more recent release is available
# shellcheck disable=SC2086
debug curl ${_NOMETER:---silent} --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE"
# shellcheck disable=SC2086
curl ${_NOMETER:---silent} --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE"
status=$(curl ${_NOMETER:---silent} -w "%{http_code}" --user-agent "$CURL_USERAGENT" "$CODE_LOCATION" --output "$TEMP_UPGRADE_FILE")
errcode=$?
debug errcode=$errcode
if [[ $errcode -eq 60 ]]; then
error_exit "curl needs updating, your version does not support SNI (multiple SSL domains on a single IP)"
@ -834,6 +837,10 @@ check_getssl_upgrade() { # check if a more recent release is available
error_exit "curl error downloading release: $errcode"
fi
if [[ $status -ne 200 ]]; then
error_exit "curl didn't find the updated version of getssl at $CODE_LOCATION"
fi
if ! install "$0" "${0}.v${VERSION}"; then
error_exit "problem renaming old version while updating, check permissions"
fi
@ -841,6 +848,17 @@ check_getssl_upgrade() { # check if a more recent release is available
error_exit "problem installing new version while updating, check permissions"
fi
check=$(bash "$0" -U -v)
release_tag_upper=$(echo "$release_tag" | tr "[:lower:]" "[:upper:]")
if [[ "$check" != "getssl ${release_tag_upper}" ]]; then
info "problem running new version, rolling back to old version"
if ! install "${0}.v${VERSION}" "$0"; then
error_exit "problem rolling back, you'll need to manually check $0 and $0.${VERSION}"
fi
error_exit "problem calling new version; output of $TEMP_UPGRADE_FILE -v was \"$check\", expected \"getssl ${release_tag_upper}\""
fi
if [[ ${_MUTE} -eq 0 ]]; then
echo "Updated getssl from v${VERSION} to ${release_tag}"
echo "The old version remains as ${0}.v${VERSION} and should be removed"


Loading…
Cancel
Save