Browse Source

updated order to better handle non-standard DOMAIN_STORAGE location

pull/61/head
srvrco 10 years ago
parent
commit
ff048ac1f8
1 changed files with 32 additions and 31 deletions
  1. +32
    -31
      getssl

+ 32
- 31
getssl View File

@ -76,10 +76,11 @@
# 2016-07-02 Corrections to work with older slackware issue #56 (1.10)
# 2016-07-02 Updating help info re ACL in config file (1.11)
# 2016-07-04 adding DOMAIN_STORAGE as a variable to solve for issue #59 (1.12)
# 2016-07-05 updated order to better handle non-standard DOMAIN_STORAGE location (1.13)
# ---------------------------------------------------------------------------
PROGNAME=${0##*/}
VERSION="1.12"
VERSION="1.13"
# defaults
CODE_LOCATION="https://raw.githubusercontent.com/srvrco/getssl/master/getssl"
@ -667,6 +668,32 @@ fi
# Check if upgrades are available
check_getssl_upgrade
# if nothing in command line, print help and exit.
if [ -z "$DOMAIN" ] && [ ${_CHECK_ALL} -ne 1 ]; then
help_message
graceful_exit
fi
# if the "working directory" doesn't exist, then create it.
if [ ! -d "$WORKING_DIR" ]; then
debug "Making working directory - $WORKING_DIR"
mkdir -p "$WORKING_DIR"
fi
# read any variables from config in working directory
if [ -f "$WORKING_DIR/getssl.cfg" ]; then
debug "reading config from $WORKING_DIR/getssl.cfg"
. "$WORKING_DIR/getssl.cfg"
fi
# Define defaults for variables unset in the main config.
ACCOUNT_KEY="${ACCOUNT_KEY:=$WORKING_DIR/account.key}"
DOMAIN_STORAGE="${DOMAIN_STORAGE:=$WORKING_DIR}"
DOMAIN_DIR="$DOMAIN_STORAGE/$DOMAIN"
CERT_FILE="$DOMAIN_DIR/${DOMAIN}.crt"
CA_CERT="$DOMAIN_DIR/chain.crt"
TEMP_DIR="$DOMAIN_DIR/tmp"
# if "-a" option then check other parameters and create run for each domain.
if [ ${_CHECK_ALL} -eq 1 ]; then
info "Check all certificates"
@ -679,14 +706,14 @@ if [ ${_CHECK_ALL} -eq 1 ]; then
error_exit "cannot combine -f|--force with -a|--all because of rate limits"
fi
if [ ! -d "$WORKING_DIR" ]; then
error_exit "working dir not found or not set - $WORKING_DIR"
if [ ! -d "$DOMAIN_STORAGE" ]; then
error_exit "DOMAIN_STORAGE not found - $DOMAIN_STORAGE"
fi
for dir in ${WORKING_DIR}/*; do
for dir in ${DOMAIN_STORAGE}/*; do
if [ -d "$dir" ]; then
debug "Checking $dir"
cmd="$0 -w '$WORKING_DIR'"
cmd="$0"
if [ ${_USE_DEBUG} -eq 1 ]; then
cmd="$cmd -d"
fi
@ -703,32 +730,6 @@ if [ ${_CHECK_ALL} -eq 1 ]; then
graceful_exit
fi # end of "-a" option.
# if nothing in command line, print help and exit.
if [ -z "$DOMAIN" ]; then
help_message
graceful_exit
fi
# if the "working directory" doesn't exist, then create it.
if [ ! -d "$WORKING_DIR" ]; then
debug "Making working directory - $WORKING_DIR"
mkdir -p "$WORKING_DIR"
fi
# read any variables from config in working directory
if [ -f "$WORKING_DIR/getssl.cfg" ]; then
debug "reading config from $WORKING_DIR/getssl.cfg"
. "$WORKING_DIR/getssl.cfg"
fi
# Define defaults for variables unset in the main config.
ACCOUNT_KEY="${ACCOUNT_KEY:=$WORKING_DIR/account.key}"
DOMAIN_STORAGE="${DOMAIN_STORAGE:=$WORKING_DIR}"
DOMAIN_DIR="$DOMAIN_STORAGE/$DOMAIN"
CERT_FILE="$DOMAIN_DIR/${DOMAIN}.crt"
CA_CERT="$DOMAIN_DIR/chain.crt"
TEMP_DIR="$DOMAIN_DIR/tmp"
# if "-c|--create" option used, then create config files.
if [ ${_CREATE_CONFIG} -eq 1 ]; then
# If main config file does not exists then create it.


Loading…
Cancel
Save