fix format

This commit is contained in:
neilpang 2017-02-14 22:41:34 +08:00
parent 5d943a35f8
commit 302c41edc9

20
acme.sh
View File

@ -2353,7 +2353,7 @@ _setNginx() {
_info "OK, Set up nginx config file" _info "OK, Set up nginx config file"
if ! sed -n "1,${_ln}p" "$_backup_conf" > "$FOUND_REAL_NGINX_CONF"; then if ! sed -n "1,${_ln}p" "$_backup_conf" >"$FOUND_REAL_NGINX_CONF"; then
cat "$_backup_conf" >"$FOUND_REAL_NGINX_CONF" cat "$_backup_conf" >"$FOUND_REAL_NGINX_CONF"
_err "write nginx conf error, but don't worry, the file is restored to the original version." _err "write nginx conf error, but don't worry, the file is restored to the original version."
return 1 return 1
@ -2415,7 +2415,7 @@ _checkConf() {
fi fi
if grep "^ *include *.*;" "$2" >/dev/null; then if grep "^ *include *.*;" "$2" >/dev/null; then
_debug "Try include files" _debug "Try include files"
for included in $(grep "^ *include *.*;" "$2"| sed "s/include //" | tr -d " ;" ); do for included in $(grep "^ *include *.*;" "$2" | sed "s/include //" | tr -d " ;"); do
_debug "check included $included" _debug "check included $included"
if _checkConf "$1" "$included"; then if _checkConf "$1" "$included"; then
return 0 return 0
@ -2433,11 +2433,17 @@ _checkConf() {
#d , conf #d , conf
_isRealNginxConf() { _isRealNginxConf() {
_debug "_isRealNginxConf $1 $2" _debug "_isRealNginxConf $1 $2"
if [ -f "$2" ] && grep "^ *server_name " "$2" | grep " $1" >/dev/null; then if [ -f "$2" ]; then
return 0 for _fln in $(grep -n "^ *server_name.* $1" "$2" | cut -d : -f 1); do
else _debug _fln "$_fln"
return 1 if [ "$_fln" ]; then
_listen=$(cat "$2" | _head_n "$_fln" | grep "^ *listen .*" | _tail_n 1)
fi fi
done
return 0
fi
return 1
} }
#restore all the nginx conf #restore all the nginx conf
@ -2455,7 +2461,7 @@ _restoreNginx() {
_ngconf=$(echo "$ng_entry" | cut -d "$sep" -f 2) _ngconf=$(echo "$ng_entry" | cut -d "$sep" -f 2)
_ngbackupconf=$(echo "$ng_entry" | cut -d "$sep" -f 3) _ngbackupconf=$(echo "$ng_entry" | cut -d "$sep" -f 3)
_info "Restoring from $_ngbackupconf to $_ngconf" _info "Restoring from $_ngbackupconf to $_ngconf"
cat "$_ngbackupconf" > "$_ngconf" cat "$_ngbackupconf" >"$_ngconf"
done done
_info "Reload nginx" _info "Reload nginx"