diff --git a/deploy/directadmin.sh b/deploy/directadmin.sh index 7db764937b..2131057291 100644 --- a/deploy/directadmin.sh +++ b/deploy/directadmin.sh @@ -87,7 +87,7 @@ _da_get_api() { # Usage: _DA_setSSL # Use the API to set the certificates _DA_setSSL() { - curData="domain=${_domain}&json=yes" + curData="domain=${_cdomain}&json=yes" _debug "Calling _da_get_api: '${curData}' '${DA_Api}/CMD_API_SSL'" _da_get_api CMD_API_SSL "${curData}" "${domain}" _secure_debug2 "response" "$response" @@ -101,10 +101,10 @@ _DA_setSSL() { ssl_on="$(echo "$cert_response" | jq -r .$name)" _debug2 "$name" "$ssl_on" - if [ "$ssl_on" == "yes" ]; then - _debug "Domain '${_domain}' has SSL enabled: $(__green "$ssl_on")" + if [ "$ssl_on" = "yes" ]; then + _debug "Domain '${_cdomain}' has SSL enabled: $(__green "$ssl_on")" else - _err "Domain '${_domain}' does not has SSL enabled: $ssl_on" + _err "Domain '${_cdomain}' does not has SSL enabled: $ssl_on" if [ -z "$FORCE" ]; then _info "Add '$(__red '--force')' to force to deploy." return 1 @@ -119,10 +119,10 @@ _DA_setSSL() { server="$(echo "$cert_response" | jq -r .$name)" _debug "$name" "$server" - if [ "$server" == "no" ]; then - _debug "Domain '${_domain}' is using a custom/pasted certificate." + if [ "$server" = "no" ]; then + _debug "Domain '${_cdomain}' is using a custom/pasted certificate." else - _err "Domain '${_domain}' is using the server certificate." + _err "Domain '${_cdomain}' is using the server certificate." if [ -z "$FORCE" ]; then _info "Add '$(__red '--force')' to force to deploy." return 1 @@ -130,9 +130,9 @@ _DA_setSSL() { fi - curData="domain=${_domain}&view=cacert&json=yes" + curData="domain=${_cdomain}&view=cacert&json=yes" _debug "Calling _DA_da_get_api_getSSL: '${curData}' '${DA_Api}/CMD_API_SSL'" - _da_get_api CMD_API_SSL "${curData}" "${_domain}" + _da_get_api CMD_API_SSL "${curData}" "${_cdomain}" _secure_debug2 "response" "$response" cacert_response=$response @@ -153,8 +153,8 @@ _DA_setSSL() { name="cacert" sameCaCert=1 - if [ "$enabled" == "yes" ]; then - _debug "Domain '${_domain}' is using a CA certificate." + if [ "$enabled" = "yes" ]; then + _debug "Domain '${_cdomain}' is using a CA certificate." cacert="$(echo "$cacert_response" | jq -r .$name)" cacert_flat="$(echo "$cacert" | tr -d '\r' | tr -d '\n')" @@ -164,12 +164,12 @@ _DA_setSSL() { sameCaCert=0 # cat <<< $cacert > ~/cacert.txt # cat <<< $cca > ~/_cca.txt - _info "Domain '${_domain}' is using $(__red 'a different') CA certificate." + _info "Domain '${_cdomain}' is using $(__red 'a different') CA certificate." else - _info "Domain '${_domain}' is using the same CA certificate." + _info "Domain '${_cdomain}' is using the same CA certificate." fi else - _err "Domain '${_domain}' is currently not using a CA certificate." + _err "Domain '${_cdomain}' is currently not using a CA certificate." if [ -z "$FORCE" ]; then _info "Add '$(__red '--force')' to force to deploy." return 1 @@ -188,9 +188,9 @@ _DA_setSSL() { sameKey=0 # cat <<< $key > ~/key.txt # cat <<< $ckey > ~/_ckey.txt - _info "Domain '${_domain}' is using $(__red 'a different') private key." + _info "Domain '${_cdomain}' is using $(__red 'a different') private key." else - _info "Domain '${_domain}' is using the same private key." + _info "Domain '${_cdomain}' is using the same private key." fi fi @@ -205,9 +205,9 @@ _DA_setSSL() { sameCert=0 # cat <<< $cert > ~/cert.txt # cat <<< $ccert > ~/_ccert.txt - _info "Domain '${_domain}' is using $(__red 'a different') certificate." + _info "Domain '${_cdomain}' is using $(__red 'a different') certificate." else - _info "Domain '${_domain}' is using the same certificate." + _info "Domain '${_cdomain}' is using the same certificate." fi fi @@ -218,12 +218,12 @@ _DA_setSSL() { encoded_cacert_value="$(printf "%s" "${cca}" | _url_encode)" _debug2 encoded_cacert_value "$encoded_cacert_value" - curData="domain=${_domain}&action=save&type=cacert&active=yes&cacert=${encoded_cacert_value}" + curData="domain=${_cdomain}&action=save&type=cacert&active=yes&cacert=${encoded_cacert_value}" response="$(_post "$curData" "${DA_Api}/CMD_API_SSL")" if _contains "${response}" 'error=0'; then - _info "$(__green 'Setting the cacert succeeded for domain '${_domain}'.')" + _info "$(__green 'Setting the cacert succeeded for domain '${_cdomain}'.')" else - _err "Setting the cacert failed for domain '${_domain}'. Check response:" + _err "Setting the cacert failed for domain '${_cdomain}'. Check response:" _err "$response" return 1 fi @@ -235,19 +235,19 @@ _DA_setSSL() { encoded_keycert_value="$(printf "%s" "${ckey}$'\n'${ccert}" | _url_encode)" _debug2 encoded_cert_value "$encoded_keycert_value" - curData="domain=${_domain}&action=save&type=paste&request=no&certificate=${encoded_keycert_value}" + curData="domain=${_cdomain}&action=save&type=paste&request=no&certificate=${encoded_keycert_value}" response="$(_post "$curData" "${DA_Api}/CMD_API_SSL")" if _contains "${response}" 'error=0'; then - _info "$(__green 'Setting the key and cert succeeded for domain '${_domain}'.')" + _info "$(__green 'Setting the key and cert succeeded for domain '${_cdomain}'.')" else - _err "Setting the key and cert failed for domain '${_domain}'. Check response:" + _err "Setting the key and cert failed for domain '${_cdomain}'. Check response:" _err "$response" return 1 fi fi else if [ $sameCaCert -eq 1 ] && [ $sameKey -eq 1 ] && [ $sameCert -eq 1 ]; then - _info "Nothing to do. Domain '${_domain}' $(__green 'has already the same certifcates active.')" + _info "Nothing to do. Domain '${_cdomain}' $(__green 'has already the same certifcates active.')" if [ -z "$FORCE" ]; then _info "Add '$(__red '--force')' to force to deploy." fi