fix: do not use local keyword as requested by @Neilpang

This commit is contained in:
ahwayakchih 2019-02-11 17:02:18 +01:00
parent b2cb73c875
commit 3fa6fb5731
2 changed files with 16 additions and 20 deletions

View File

@ -14,12 +14,12 @@
# Usage: mydevil_deploy domain keyfile certfile cafile fullchain # Usage: mydevil_deploy domain keyfile certfile cafile fullchain
mydevil_deploy() { mydevil_deploy() {
local _cdomain="$1" _cdomain="$1"
local _ckey="$2" _ckey="$2"
local _ccert="$3" _ccert="$3"
local _cca="$4" _cca="$4"
local _cfullchain="$5" _cfullchain="$5"
local ip="" ip=""
_debug _cdomain "$_cdomain" _debug _cdomain "$_cdomain"
_debug _ckey "$_ckey" _debug _ckey "$_ckey"
@ -49,8 +49,6 @@ mydevil_deploy() {
# Usage: ip=$(mydevil_get_ip domain.com) # Usage: ip=$(mydevil_get_ip domain.com)
# echo $ip # echo $ip
mydevil_get_ip() { mydevil_get_ip() {
local domain=$1 devil dns list "$1" | awk '{print $3"\t"$7}' | grep "^A$(printf '\t')" | awk '{print $2}' || return 1
devil dns list "$domain" | awk '{print $3"\t"$7}' | grep "^A$(printf '\t')" | awk '{print $2}' || return 1
return 0 return 0
} }

View File

@ -14,9 +14,9 @@
#Usage: dns_mydevil_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" #Usage: dns_mydevil_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
dns_mydevil_add() { dns_mydevil_add() {
local fulldomain=$1 fulldomain=$1
local txtvalue=$2 txtvalue=$2
local domain="" domain=""
_info "Using mydevil" _info "Using mydevil"
@ -44,9 +44,9 @@ dns_mydevil_add() {
#Usage: fulldomain txtvalue #Usage: fulldomain txtvalue
#Remove the txt record after validation. #Remove the txt record after validation.
dns_mydevil_rm() { dns_mydevil_rm() {
local fulldomain=$1 fulldomain=$1
local txtvalue=$2 txtvalue=$2
local domain="" domain=""
_info "Using mydevil" _info "Using mydevil"
@ -71,9 +71,7 @@ dns_mydevil_rm() {
# Usage: mydevil_check_record "_acme-challenge.www.domain.com" || _err "Invalid record name" # Usage: mydevil_check_record "_acme-challenge.www.domain.com" || _err "Invalid record name"
mydevil_check_record() { mydevil_check_record() {
local record=$1 case "$1" in
case "$record" in
"_acme-challenge."*) "_acme-challenge."*)
return 0 return 0
;; ;;
@ -86,8 +84,8 @@ mydevil_check_record() {
# Usage: domain=$(mydevil_get_domain "_acme-challenge.www.domain.com" || _err "Invalid domain name") # Usage: domain=$(mydevil_get_domain "_acme-challenge.www.domain.com" || _err "Invalid domain name")
# echo $domain # echo $domain
mydevil_get_domain() { mydevil_get_domain() {
local fulldomain=$1 fulldomain=$1
local domain="" domain=""
for domain in $(devil dns list | grep . | awk '{if(NR>1)print $1}'); do for domain in $(devil dns list | grep . | awk '{if(NR>1)print $1}'); do
if _endswith "$fulldomain" "$domain"; then if _endswith "$fulldomain" "$domain"; then