Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
e9f9f515
Commit
e9f9f515
authored
Nov 12, 2016
by
neilpang
Browse files
fix shellcheck warnings.
parent
efd96153
Changes
6
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_gd.sh
View file @
e9f9f515
...
...
@@ -85,8 +85,8 @@ _get_root() {
_domain
=
"
$h
"
return
0
fi
p
=
$i
i
=
$(
expr
$i
+ 1
)
p
=
"
$i
"
i
=
$(
_math
"
$i
"
+ 1
)
done
return
1
}
...
...
dnsapi/dns_lexicon.sh
View file @
e9f9f515
...
...
@@ -29,7 +29,7 @@ dns_lexicon_add() {
_savedomainconf PROVIDER
"
$PROVIDER
"
export
PROVIDER
Lx_name
=
$(
echo
LEXICON_
${
PROVIDER
}
_USERNAME |
tr
'[a-z]'
'[A-Z]'
)
Lx_name
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_USERNAME |
tr
'[a-z]'
'[A-Z]'
)
eval
Lx_name_v
=
"
\$
$Lx_name
"
_debug
"
$Lx_name
"
"
$Lx_name_v
"
if
[
"
$Lx_name_v
"
]
;
then
...
...
@@ -37,7 +37,7 @@ dns_lexicon_add() {
export
"
$Lx_name
"
fi
Lx_token
=
$(
echo
LEXICON_
${
PROVIDER
}
_TOKEN |
tr
'[a-z]'
'[A-Z]'
)
Lx_token
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_TOKEN |
tr
'[a-z]'
'[A-Z]'
)
eval
Lx_token_v
=
"
\$
$Lx_token
"
_debug
"
$Lx_token
"
"
$Lx_token_v
"
if
[
"
$Lx_token_v
"
]
;
then
...
...
@@ -45,7 +45,7 @@ dns_lexicon_add() {
export
"
$Lx_token
"
fi
Lx_password
=
$(
echo
LEXICON_
${
PROVIDER
}
_PASSWORD |
tr
'[a-z]'
'[A-Z]'
)
Lx_password
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_PASSWORD |
tr
'[a-z]'
'[A-Z]'
)
eval
Lx_password_v
=
"
\$
$Lx_password
"
_debug
"
$Lx_password
"
"
$Lx_password_v
"
if
[
"
$Lx_password_v
"
]
;
then
...
...
@@ -53,7 +53,7 @@ dns_lexicon_add() {
export
"
$Lx_password
"
fi
Lx_domaintoken
=
$(
echo
LEXICON_
${
PROVIDER
}
_DOMAINTOKEN |
tr
'[a-z]'
'[A-Z]'
)
Lx_domaintoken
=
$(
echo
LEXICON_
"
${
PROVIDER
}
"
_DOMAINTOKEN |
tr
'[a-z]'
'[A-Z]'
)
eval
Lx_domaintoken_v
=
"
\$
$Lx_domaintoken
"
_debug
"
$Lx_domaintoken
"
"
$Lx_domaintoken_v
"
if
[
"
$Lx_domaintoken_v
"
]
;
then
...
...
@@ -61,7 +61,7 @@ dns_lexicon_add() {
_saveaccountconf
"
$Lx_domaintoken
"
"
$Lx_domaintoken_v
"
fi
$lexicon_cmd
"
$PROVIDER
"
create
${
domain
}
TXT
--name
=
"_acme-challenge.
${
domain
}
."
--content
=
"
${
txtvalue
}
"
$lexicon_cmd
"
$PROVIDER
"
create
"
${
domain
}
"
TXT
--name
=
"_acme-challenge.
${
domain
}
."
--content
=
"
${
txtvalue
}
"
}
...
...
dnsapi/dns_lua.sh
View file @
e9f9f515
...
...
@@ -44,7 +44,7 @@ dns_lua_add() {
return
1
fi
count
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
\"
name
\"
:
\"
$fulldomain
\"
|
wc
-l
)
count
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
name
\"
:
\"
$fulldomain
\"
"
|
wc
-l
)
_debug count
"
$count
"
if
[
"
$count
"
=
"0"
]
;
then
_info
"Adding record"
...
...
@@ -61,7 +61,7 @@ dns_lua_add() {
_err
"Add txt record error."
else
_info
"Updating record"
record_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
\"
id
\"
:[^,]
*
,
\"
name
\"
:
\"
$fulldomain
.
\"
,
\"
type
\"
:
\"
TXT
\"
|
cut
-d
:
-f2
|
cut
-d
,
-f1
)
record_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
id
\"
:[^,]*,
\"
name
\"
:
\"
$fulldomain
.
\"
,
\"
type
\"
:
\"
TXT
\"
"
|
cut
-d
:
-f2
|
cut
-d
,
-f1
)
_debug
"record_id"
"
$record_id
"
_LUA_rest PUT
"zones/
$_domain_id
/records/
$record_id
"
"{
\"
id
\"
:
\"
$record_id
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$fulldomain
.
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
zone_id
\"
:
\"
$_domain_id
\"
,
\"
ttl
\"
:120}"
...
...
@@ -103,7 +103,7 @@ _get_root() {
fi
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
;
then
_domain_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
\"
id
\"
:[^,]
*
,
\"
name
\"
:
\"
$h
\"
|
cut
-d
:
-f
2 |
cut
-d
,
-f
1
)
_domain_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
id
\"
:[^,]*,
\"
name
\"
:
\"
$h
\"
"
|
cut
-d
:
-f
2 |
cut
-d
,
-f
1
)
if
[
"
$_domain_id
"
]
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_domain
=
"
$h
"
...
...
@@ -127,7 +127,7 @@ _LUA_rest() {
_H2
=
"Authorization: Basic
$LUA_auth
"
if
[
"
$data
"
]
;
then
_debug data
"
$data
"
response
=
"
$(
_post
"
$data
"
"
$LUA_Api
/
$ep
"
""
$m
)
"
response
=
"
$(
_post
"
$data
"
"
$LUA_Api
/
$ep
"
""
"
$m
"
)
"
else
response
=
"
$(
_get
"
$LUA_Api
/
$ep
"
)
"
fi
...
...
dnsapi/dns_me.sh
View file @
e9f9f515
...
...
@@ -130,7 +130,7 @@ _me_rest() {
if
[
"
$data
"
]
;
then
_debug data
"
$data
"
response
=
"
$(
_post
"
$data
"
"
$ME_Api
/
$ep
"
""
$m
)
"
response
=
"
$(
_post
"
$data
"
"
$ME_Api
/
$ep
"
""
"
$m
"
)
"
else
response
=
"
$(
_get
"
$ME_Api
/
$ep
"
)
"
fi
...
...
dnsapi/dns_ovh.sh
View file @
e9f9f515
...
...
@@ -127,7 +127,7 @@ dns_ovh_add() {
_info
"Consumer key is ok."
_debug
"First detect the root zone"
if
!
_get_root
$fulldomain
;
then
if
!
_get_root
"
$fulldomain
"
;
then
_err
"invalid domain"
return
1
fi
...
...
@@ -157,7 +157,7 @@ dns_ovh_add() {
_err
"Can not get record id."
return
1
fi
_debug
"record_id"
$record_id
_debug
"record_id"
"
$record_id
"
if
_ovh_rest PUT
"domain/zone/
$_domain
/record/
$record_id
"
"{
\"
target
\"
:
\"
$txtvalue
\"
,
\"
subDomain
\"
:
\"
$_sub_domain
\"
,
\"
ttl
\"
:60}"
;
then
if
_contains
"
$response
"
"null"
;
then
...
...
@@ -280,7 +280,7 @@ _ovh_rest() {
_H5
=
"Content-Type: application/json;charset=utf-8"
if
[
"
$data
"
]
||
[
"
$m
"
=
"POST"
]
||
[
"
$m
"
=
"PUT"
]
;
then
_debug data
"
$data
"
response
=
"
$(
_post
"
$data
"
"
$_ovh_url
"
""
$m
)
"
response
=
"
$(
_post
"
$data
"
"
$_ovh_url
"
""
"
$m
"
)
"
else
response
=
"
$(
_get
"
$_ovh_url
"
)
"
fi
...
...
dnsapi/dns_pdns.sh
View file @
e9f9f515
...
...
@@ -91,7 +91,6 @@ set_record() {
_get_root
()
{
domain
=
$1
i
=
1
p
=
1
if
_pdns_rest
"GET"
"/api/v1/servers/
$PDNS_ServerId
/zones"
;
then
_zones_response
=
"
$response
"
...
...
@@ -108,7 +107,6 @@ _get_root() {
return
0
fi
p
=
$i
i
=
$(
_math
$i
+ 1
)
done
_debug
"
$domain
not found"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment