@ -220,6 +220,7 @@
# 2020-03-23 Fix staging server URL in domain template (2.21)
# 2020-03-23 Fix staging server URL in domain template (2.21)
# 2020-03-30 Fix error message find_dns_utils from over version of "command"
# 2020-03-30 Fix error message find_dns_utils from over version of "command"
# 2020-03-30 Fix problems if domain name isn't in lowercase (2.22)
# 2020-03-30 Fix problems if domain name isn't in lowercase (2.22)
# 2020-04-16 Add alternative working dirs '/etc/getssl/' '${SCRIPTDIR}/conf' '${SCRIPTDIR}/.getssl'
# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------
PROGNAME=${0##*/}
PROGNAME=${0##*/}
@ -261,7 +262,7 @@ TEMP_UPGRADE_FILE=""
TOKEN_USER_ID=""
TOKEN_USER_ID=""
USE_SINGLE_ACL="false"
USE_SINGLE_ACL="false"
VALIDATE_VIA_DNS=""
VALIDATE_VIA_DNS=""
WORKING_DIR=~/.getssl
WORKING_DIR_CANDIDATES =('/etc/getssl/' '${SCRIPTDIR}/conf' '${SCRIPTDIR}/.getssl' ' ~/.getssl')
_CHECK_ALL=0
_CHECK_ALL=0
_CREATE_CONFIG=0
_CREATE_CONFIG=0
_FORCE_RENEW=0
_FORCE_RENEW=0
@ -2179,6 +2180,7 @@ requires which
requires openssl
requires openssl
requires curl
requires curl
requires dig nslookup drill host DNS_CHECK_FUNC
requires dig nslookup drill host DNS_CHECK_FUNC
requires dirname
requires awk
requires awk
requires tr
requires tr
requires date
requires date
@ -2216,6 +2218,22 @@ if [[ -z "$DOMAIN" ]] && [[ ${_CHECK_ALL} -ne 1 ]]; then
graceful_exit
graceful_exit
fi
fi
# Test working directory candidates if unset. Last candidate defaults (~/getssl/)
if [[ -z "${WORKING_DIR}" ]]
then
SCRIPTDIR="$(cd "$(dirname "$0")"; pwd -P;)"
for WDCC in $(seq 0 $((${#WORKING_DIR_CANDIDATES[@]}-1)) )
do
WORKING_DIR="$(eval echo "${WORKING_DIR_CANDIDATES[$WDCC]}")"
debug "Testing working dir location '${WORKING_DIR}'"
if [[ -s "$WORKING_DIR/getssl.cfg" ]]
then
break
fi
done
fi
# if the "working directory" doesn't exist, then create it.
# if the "working directory" doesn't exist, then create it.
if [[ ! -d "$WORKING_DIR" ]]; then
if [[ ! -d "$WORKING_DIR" ]]; then
debug "Making working directory - $WORKING_DIR"
debug "Making working directory - $WORKING_DIR"