Skip to content

Commit

Permalink
Merge pull request #4663 from acmesh-official/dev
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
Neilpang committed Jun 9, 2023
2 parents 38c5910 + 891198e commit b7caf7a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 38 deletions.
40 changes: 8 additions & 32 deletions acme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2936,22 +2936,6 @@ _initpath() {

}

_exec() {
if [ -z "$_EXEC_TEMP_ERR" ]; then
_EXEC_TEMP_ERR="$(_mktemp)"
fi

if [ "$_EXEC_TEMP_ERR" ]; then
eval "$@ 2>>$_EXEC_TEMP_ERR"
else
eval "$@"
fi
}

_exec_err() {
[ "$_EXEC_TEMP_ERR" ] && _err "$(cat "$_EXEC_TEMP_ERR")" && echo "" >"$_EXEC_TEMP_ERR"
}

_apachePath() {
_APACHECTL="apachectl"
if ! _exists apachectl; then
Expand All @@ -2964,8 +2948,7 @@ _apachePath() {
fi
fi

if ! _exec $_APACHECTL -V >/dev/null; then
_exec_err
if ! $_APACHECTL -V >/dev/null; then
return 1
fi

Expand Down Expand Up @@ -3017,8 +3000,7 @@ _restoreApache() {

cat "$APACHE_CONF_BACKUP_DIR/$httpdconfname" >"$httpdconf"
_debug "Restored: $httpdconf."
if ! _exec $_APACHECTL -t; then
_exec_err
if ! $_APACHECTL -t; then
_err "Sorry, restore apache config error, please contact me."
return 1
fi
Expand All @@ -3036,8 +3018,7 @@ _setApache() {
#test the conf first
_info "Checking if there is an error in the apache config file before starting."

if ! _exec "$_APACHECTL" -t >/dev/null; then
_exec_err
if ! $_APACHECTL -t >/dev/null; then
_err "The apache config file has error, please fix it first, then try again."
_err "Don't worry, there is nothing changed to your system."
return 1
Expand Down Expand Up @@ -3098,8 +3079,7 @@ Allow from all
chmod 755 "$ACME_DIR"
fi

if ! _exec "$_APACHECTL" graceful; then
_exec_err
if ! $_APACHECTL graceful; then
_err "$_APACHECTL graceful error, please contact me."
_restoreApache
return 1
Expand Down Expand Up @@ -3184,8 +3164,7 @@ _setNginx() {
return 1
fi
_info "Check the nginx conf before setting up."
if ! _exec "nginx -t" >/dev/null; then
_exec_err
if ! nginx -t >/dev/null; then
return 1
fi

Expand All @@ -3212,16 +3191,14 @@ location ~ \"^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)\$\" {
fi
_debug3 "Modified config:$(cat $FOUND_REAL_NGINX_CONF)"
_info "nginx conf is done, let's check it again."
if ! _exec "nginx -t" >/dev/null; then
_exec_err
if ! nginx -t >/dev/null; then
_err "It seems that nginx conf was broken, let's restore."
cat "$_backup_conf" >"$FOUND_REAL_NGINX_CONF"
return 1
fi

_info "Reload nginx"
if ! _exec "nginx -s reload" >/dev/null; then
_exec_err
if ! nginx -s reload >/dev/null; then
_err "It seems that nginx reload error, let's restore."
cat "$_backup_conf" >"$FOUND_REAL_NGINX_CONF"
return 1
Expand Down Expand Up @@ -3346,8 +3323,7 @@ _restoreNginx() {
done

_info "Reload nginx"
if ! _exec "nginx -s reload" >/dev/null; then
_exec_err
if ! nginx -s reload >/dev/null; then
_err "It seems that nginx reload error, please report bug."
return 1
fi
Expand Down
17 changes: 11 additions & 6 deletions dnsapi/dns_ovh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#'ovh-eu'
OVH_EU='https://eu.api.ovh.com/1.0'

#'ovh-us'
OVH_US='https://api.us.ovhcloud.com/1.0'

#'ovh-ca':
OVH_CA='https://ca.api.ovh.com/1.0'

Expand All @@ -29,9 +32,6 @@ SYS_EU='https://eu.api.soyoustart.com/1.0'
#'soyoustart-ca'
SYS_CA='https://ca.api.soyoustart.com/1.0'

#'runabove-ca'
RAV_CA='https://api.runabove.com/1.0'

wiki="https://github.com/acmesh-official/acme.sh/wiki/How-to-use-OVH-domain-api"

ovh_success="https://github.com/acmesh-official/acme.sh/wiki/OVH-Success"
Expand All @@ -45,6 +45,10 @@ _ovh_get_api() {
printf "%s" $OVH_EU
return
;;
ovh-us | ovhus)
printf "%s" $OVH_US
return
;;
ovh-ca | ovhca)
printf "%s" $OVH_CA
return
Expand All @@ -65,14 +69,15 @@ _ovh_get_api() {
printf "%s" $SYS_CA
return
;;
runabove-ca | runaboveca)
printf "%s" $RAV_CA
# raw API url starts with https://
https*)
printf "%s" "$1"
return
;;

*)

_err "Unknown parameter : $1"
_err "Unknown endpoint : $1"
return 1
;;
esac
Expand Down

0 comments on commit b7caf7a

Please sign in to comment.