271271# 2021-08-26 Improve upgrade check & make upgrade do a full install when possible (tlhackque) (#694) (2.42)
272272# 2021-09-02 Fix version compare - cURL v8 may have single digit minor numbers. (tlhackque) (2.43)
273273# 2021-09-26 Delete key file when key algorithm has changed (makuhama)
274+ # 2021-09-30 better error if curl returns 60 (#709)
275+ # 2021-10-01 Fix -preferred-chain argument (#712)
276+ # 2021-10-01 Show help if no domain specified (#705)(2.44)
274277# ----------------------------------------------------------------------------------------
275278
276279case :$SHELLOPTS : in
279282
280283PROGNAME=${0##*/ }
281284PROGDIR=" $( cd " $( dirname " $0 " ) " || exit ; pwd -P; ) "
282- VERSION=" 2.43 "
285+ VERSION=" 2.44 "
283286
284287# defaults
285288ACCOUNT_KEY_LENGTH=4096
@@ -290,7 +293,7 @@ CHALLENGE_CHECK_TYPE="http"
290293CHECK_REMOTE_WAIT=0
291294CHECK_REMOTE=" true"
292295if [[ -n " ${GITHUB_REPOSITORY} " ]] ; then
293- CODE_LOCATION=" https://raw.githubusercontent.com/${GITHUB_REPOSITORY} /getssl/ master/getssl"
296+ CODE_LOCATION=" https://raw.githubusercontent.com/${GITHUB_REPOSITORY} /master/getssl"
294297 RELEASE_API=" https://api.github.com/repos/${GITHUB_REPOSITORY} /releases/latest"
295298else
296299 CODE_LOCATION=" https://raw.githubusercontent.com/srvrco/getssl/master/getssl"
@@ -784,7 +787,7 @@ check_getssl_upgrade() { # check if a more recent release is available
784787 # Replace error in release description with _error (which is ignored by check_output_for_errors() in the tests)
785788 debug " ${release_data// error/ _error} "
786789 release_data=" $( sed -e' s/^ *//g' <<< " ${release_data}" ) "
787- release_tag=" $( sed -e' /^ "tag_name": *"/!d;s/^ "tag_name": *"\([^""]*\).*$/\1/' <<< " ${release_data}" ) "
790+ release_tag=" $( sed -e' /"tag_name": *"/!d;s/"tag_name": *"\([^""]*\).*$/\1/' <<< " ${release_data}" ) "
788791 if [[ " ${release_tag: 0: 1} " != ' v' ]] ; then
789792 if [[ ${_MUTE} -eq 0 ]]; then
790793 info " The current repository has no releases or is improperly tagged; can't check for upgrades: '$release_tag '"
@@ -820,7 +823,7 @@ check_getssl_upgrade() { # check if a more recent release is available
820823 if [ " $TEMP_UPGRADE_FILE " == " " ]; then
821824 error_exit " mktemp failed"
822825 fi
823- CODE_LOCATION=$( sed -e" s/getssl\/ master/${release_tag} /" <<< " $CODE_LOCATION" )
826+ CODE_LOCATION=$( sed -e" s/master/${release_tag} /" <<< " $CODE_LOCATION" )
824827 # shellcheck disable=SC2086
825828 debug curl ${_NOMETER:- --silent} --user-agent " $CURL_USERAGENT " " $CODE_LOCATION " --output " $TEMP_UPGRADE_FILE "
826829 # shellcheck disable=SC2086
@@ -2427,7 +2430,7 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
24272430 fi
24282431 debug " response status = $response_status "
24292432 if [[ " $code " -eq 500 ]]; then
2430- info " error on acme server - trying again ...."
2433+ info " _error on acme server - trying again ...."
24312434 debug " loop_limit = $loop_limit "
24322435 sleep 5
24332436 loop_limit=$(( loop_limit - 1 ))
@@ -2755,7 +2758,7 @@ while [[ -n ${1+defined} ]]; do
27552758 _ONLY_CHECK_CONFIG=1 ;;
27562759 -w)
27572760 shift ; WORKING_DIR=" $1 " ;;
2758- -preferred-chain)
2761+ -preferred-chain | --preferred-chain )
27592762 shift ; PREFERRED_CHAIN=" $1 " ;;
27602763 --source)
27612764 return ;;
@@ -2830,6 +2833,10 @@ if [[ $_UPGRADE_CHECK -eq 1 ]]; then
28302833 # if nothing in command line and no revocation and not only config check,
28312834 # then exit after upgrade
28322835 if [[ -z " $DOMAIN " ]] && [[ ${_CHECK_ALL} -ne 1 ]] && [[ ${_REVOKE} -ne 1 ]] && [ " ${_ONLY_CHECK_CONFIG} " -ne 1 ]; then
2836+ # if nothing in command line, print help before exit.
2837+ if [[ -z " $DOMAIN " ]] && [[ ${_CHECK_ALL} -ne 1 ]]; then
2838+ help_message
2839+ fi
28332840 graceful_exit
28342841 fi
28352842fi
0 commit comments