From fdcb6b721c660235c0d8bdcada9086622575e3b8 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 30 Sep 2016 22:13:27 +0800 Subject: [PATCH] fix for busybox --- acme.sh | 28 +++++++++++++++++++++++----- dnsapi/dns_cx.sh | 4 ++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/acme.sh b/acme.sh index 13dc865d..3b3891fa 100755 --- a/acme.sh +++ b/acme.sh @@ -1246,6 +1246,24 @@ _stopserver(){ fi } +# sleep sec +_sleep() { + _sleep_sec="$1" + if [ "$__INTERACTIVE" ] ; then + printf "\n" + _sleep_c="$_sleep_sec" + while [ "$_sleep_c" -ge "0" ] ; + do + printf "\r" + __green "$_sleep_c" + _sleep_c="$(_math $_sleep_c - 1)" + sleep 1 + done + printf "\n" + else + sleep "$_sleep_sec" + fi +} # _starttlsserver san_a san_b port content _starttlsserver() { @@ -1290,7 +1308,7 @@ _starttlsserver() { fi serverproc="$!" - sleep 2 + _sleep 2 _debug serverproc $serverproc } @@ -2070,7 +2088,7 @@ issue() { return 1 fi - entry="$(printf "%s\n" "$response" | _egrep_o '[^{]*"type":"'$vtype'"[^}]*')" + entry="$(printf "%s\n" "$response" | _egrep_o '[^\{]*"type":"'$vtype'"[^\}]*')" _debug entry "$entry" if [ -z "$entry" ] ; then _err "Error, can not get domain token $d" @@ -2198,7 +2216,7 @@ issue() { fi _info "Sleep $(__green $Le_DNSSleep) seconds for the txt records to take effect" - sleep $Le_DNSSleep + _sleep $Le_DNSSleep fi _debug "ok, let's start to verify" @@ -2366,7 +2384,7 @@ issue() { fi if [ "$status" = "invalid" ] ; then - error="$(echo "$response" | _egrep_o '"error":\{[^}]*}')" + error="$(echo "$response" | _egrep_o '"error":\{[^\}]*\}')" _debug2 error "$error" errordetail="$(echo $error | _egrep_o '"detail": *"[^"]*"' | cut -d '"' -f 4)" _debug2 errordetail "$errordetail" @@ -2944,7 +2962,7 @@ _deactivate() { return 1 fi - entry="$(printf "%s\n" "$response" | _egrep_o '[^{]*"status":"valid","uri"[^}]*')" + entry="$(printf "%s\n" "$response" | _egrep_o '[^\{]*"status":"valid","uri"[^\}]*')" _debug entry "$entry" if [ -z "$entry" ] ; then diff --git a/dnsapi/dns_cx.sh b/dnsapi/dns_cx.sh index 60951722..1a2e04e7 100755 --- a/dnsapi/dns_cx.sh +++ b/dnsapi/dns_cx.sh @@ -69,7 +69,7 @@ existing_records() { return 1 fi count=0 - 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 @@ -145,7 +145,7 @@ _get_root() { fi if printf "$response" | grep "$h." >/dev/null ; then - seg=$(printf "%s" "$response" | _egrep_o "{[^{]*\"$h\.\"[^}]*\}" ) + seg=$(printf "%s" "$response" | _egrep_o "\{[^\{]*\"$h\.\"[^\}]*\}" ) _debug seg "$seg" _domain_id=$(printf "%s" "$seg" | _egrep_o \"id\":\"[^\"]*\" | cut -d : -f 2 | tr -d \") _debug _domain_id "$_domain_id"