fix for busybox

This commit is contained in:
neil 2016-09-30 22:13:27 +08:00
parent ef858ef062
commit fdcb6b721c
2 changed files with 25 additions and 7 deletions

28
acme.sh
View File

@ -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

View File

@ -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"