Browse Source

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

pull/2076/head
ahwayakchih 7 years ago
parent
commit
3fa6fb5731
  1. 16
      deploy/mydevil.sh
  2. 20
      dnsapi/dns_mydevil.sh

16
deploy/mydevil.sh

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

20
dnsapi/dns_mydevil.sh

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

Loading…
Cancel
Save