style: restyle MyDevil.net scripts to pass ShellCheck.net validation

This commit is contained in:
ahwayakchih 2019-02-03 16:51:14 +01:00
parent 1983913ed1
commit 3bb7022919
2 changed files with 15 additions and 13 deletions

View File

@ -14,11 +14,12 @@
# Usage: mydevil_deploy domain keyfile certfile cafile fullchain
mydevil_deploy() {
_cdomain="$1"
_ckey="$2"
_ccert="$3"
_cca="$4"
_cfullchain="$5"
local _cdomain="$1"
local _ckey="$2"
local _ccert="$3"
local _cca="$4"
local _cfullchain="$5"
local ip=""
_debug _cdomain "$_cdomain"
_debug _ckey "$_ckey"
@ -26,8 +27,7 @@ mydevil_deploy() {
_debug _cca "$_cca"
_debug _cfullchain "$_cfullchain"
local ip=$(mydevil_get_ip $_cdomain)
ip=$(mydevil_get_ip "$_cdomain")
if [ -z "$ip" ] ; then
_err "Could not find IP for domain $_cdomain."
return 1

View File

@ -16,11 +16,12 @@
dns_mydevil_add() {
local fulldomain=$1
local txtvalue=$2
local domain=$(mydevil_get_domain "$fulldomain")
local domain=""
_info "Using mydevil"
if ! mydevil_check_record $fulldomain ; then
domain=$(mydevil_get_domain "$fulldomain")
if ! mydevil_check_record "$fulldomain" ; then
_err "Invalid record name: does not start with '_acme-challenge'."
return 1
fi
@ -45,11 +46,12 @@ dns_mydevil_add() {
dns_mydevil_rm() {
local fulldomain=$1
local txtvalue=$2
local domain=$(mydevil_get_domain "$fulldomain")
local domain=""
_info "Using mydevil"
if ! mydevil_check_record $fulldomain ; then
domain=$(mydevil_get_domain "$fulldomain")
if ! mydevil_check_record "$fulldomain" ; then
_err "Invalid record name: does not start with '_acme-challenge'."
return 1
fi
@ -59,7 +61,7 @@ dns_mydevil_rm() {
return 1
fi
for id in `devil dns list "$domain" | grep "$fulldomain" | awk '{print $1}'` ; do
for id in $(devil dns list "$domain" | grep "$fulldomain" | awk '{print $1}') ; do
_info "Removing record $id from domain $domain"
devil dns del "$domain" "$id" || _err "Could not remove DNS record."
done
@ -87,7 +89,7 @@ mydevil_get_domain() {
local fulldomain=$1
local 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
printf -- "%s" "$domain"
return 0