From b43416af97b3cc48625773a3635d694e2e923198 Mon Sep 17 00:00:00 2001 From: neilpang Date: Fri, 2 Dec 2016 20:24:12 +0800 Subject: [PATCH 1/4] do not use script home --- acme.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/acme.sh b/acme.sh index d886bfe..c7c9f9f 100755 --- a/acme.sh +++ b/acme.sh @@ -1612,14 +1612,14 @@ __initHome() { fi fi - if [ -z "$LE_WORKING_DIR" ]; then - if [ -f "$DEFAULT_INSTALL_HOME/account.conf" ]; then - _debug "It seems that $PROJECT_NAME is already installed in $DEFAULT_INSTALL_HOME" - LE_WORKING_DIR="$DEFAULT_INSTALL_HOME" - else - LE_WORKING_DIR="$_SCRIPT_HOME" - fi - fi +# if [ -z "$LE_WORKING_DIR" ]; then +# if [ -f "$DEFAULT_INSTALL_HOME/account.conf" ]; then +# _debug "It seems that $PROJECT_NAME is already installed in $DEFAULT_INSTALL_HOME" +# LE_WORKING_DIR="$DEFAULT_INSTALL_HOME" +# else +# LE_WORKING_DIR="$_SCRIPT_HOME" +# fi +# fi if [ -z "$LE_WORKING_DIR" ]; then _debug "Using default home:$DEFAULT_INSTALL_HOME" From 219e9115c03723d01dbb2eca6c26797875529842 Mon Sep 17 00:00:00 2001 From: neilpang Date: Fri, 2 Dec 2016 20:30:52 +0800 Subject: [PATCH 2/4] fix format --- acme.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/acme.sh b/acme.sh index c7c9f9f..a669aba 100755 --- a/acme.sh +++ b/acme.sh @@ -1612,14 +1612,14 @@ __initHome() { fi fi -# if [ -z "$LE_WORKING_DIR" ]; then -# if [ -f "$DEFAULT_INSTALL_HOME/account.conf" ]; then -# _debug "It seems that $PROJECT_NAME is already installed in $DEFAULT_INSTALL_HOME" -# LE_WORKING_DIR="$DEFAULT_INSTALL_HOME" -# else -# LE_WORKING_DIR="$_SCRIPT_HOME" -# fi -# fi + # if [ -z "$LE_WORKING_DIR" ]; then + # if [ -f "$DEFAULT_INSTALL_HOME/account.conf" ]; then + # _debug "It seems that $PROJECT_NAME is already installed in $DEFAULT_INSTALL_HOME" + # LE_WORKING_DIR="$DEFAULT_INSTALL_HOME" + # else + # LE_WORKING_DIR="$_SCRIPT_HOME" + # fi + # fi if [ -z "$LE_WORKING_DIR" ]; then _debug "Using default home:$DEFAULT_INSTALL_HOME" From d69f0289caf15b1b8b8516a92b18ea68087024bc Mon Sep 17 00:00:00 2001 From: neilpang Date: Sun, 4 Dec 2016 12:22:36 +0800 Subject: [PATCH 3/4] fix issue when there is no one records in the domain. --- dnsapi/dns_cx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dnsapi/dns_cx.sh b/dnsapi/dns_cx.sh index 0caf0c0..91556c6 100755 --- a/dnsapi/dns_cx.sh +++ b/dnsapi/dns_cx.sh @@ -69,11 +69,11 @@ existing_records() { _debug "Getting txt records" root=$1 sub=$2 - + count=0 if ! _rest GET "record/$_domain_id?:domain_id?host_id=0&offset=0&row_num=100"; then return 1 fi - count=0 + seg=$(printf "%s\n" "$response" | _egrep_o "{[^\{]*host\":\"$_sub_domain\"[^\}]*\}") _debug seg "$seg" if [ -z "$seg" ]; then From 5be3f22d06cd62397395b0de4e76f3f1d3c27405 Mon Sep 17 00:00:00 2001 From: neilpang Date: Sun, 4 Dec 2016 14:45:26 +0800 Subject: [PATCH 4/4] fix issue --- dnsapi/dns_cx.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dnsapi/dns_cx.sh b/dnsapi/dns_cx.sh index 91556c6..ff1c943 100755 --- a/dnsapi/dns_cx.sh +++ b/dnsapi/dns_cx.sh @@ -74,7 +74,7 @@ existing_records() { return 1 fi - seg=$(printf "%s\n" "$response" | _egrep_o "{[^\{]*host\":\"$_sub_domain\"[^\}]*\}") + seg=$(printf "%s\n" "$response" | _egrep_o '{[^{]*host":"'"$_sub_domain"'"[^}]*\}') _debug seg "$seg" if [ -z "$seg" ]; then return 0 @@ -82,7 +82,7 @@ existing_records() { if printf "%s" "$response" | grep '"type":"TXT"' >/dev/null; then count=1 - record_id=$(printf "%s\n" "$seg" | _egrep_o "\"record_id\":\"[^\"]*\"" | cut -d : -f 2 | tr -d \") + record_id=$(printf "%s\n" "$seg" | _egrep_o '"record_id":"[^"]*"' | cut -d : -f 2 | tr -d \" | _head_n 1) _debug record_id "$record_id" return 0 fi @@ -170,7 +170,7 @@ _get_root() { _rest() { m=$1 ep="$2" - _debug "$ep" + _debug ep "$ep" url="$REST_API/$ep" _debug url "$url"