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
b00919c6
Commit
b00919c6
authored
Feb 17, 2018
by
nytral
Browse files
various fixes
parent
4a6b31fb
Changes
2
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_lua.sh
View file @
b00919c6
#!/
usr/bin/env
sh
#!/
bin/ba
sh
# bug reports to dev@1e.ca
# bug reports to dev@1e.ca
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#LUA_Email="user@luadns.net"
#LUA_Email="user@luadns.net"
LUA_Api
=
"https://api.luadns.com/v1"
LUA_Api
=
"https://api.luadns.com/v1"
LUA_auth
=
$(
printf
"%s"
"
$LUA_Email
:
$LUA_Key
"
| _base64
)
######## Public functions #####################
######## Public functions #####################
...
@@ -19,6 +18,8 @@ dns_lua_add() {
...
@@ -19,6 +18,8 @@ dns_lua_add() {
LUA_Key
=
"
${
LUA_Key
:-
$(
_readaccountconf_mutable LUA_Key
)
}
"
LUA_Key
=
"
${
LUA_Key
:-
$(
_readaccountconf_mutable LUA_Key
)
}
"
LUA_Email
=
"
${
LUA_Email
:-
$(
_readaccountconf_mutable LUA_Email
)
}
"
LUA_Email
=
"
${
LUA_Email
:-
$(
_readaccountconf_mutable LUA_Email
)
}
"
LUA_auth
=
$(
printf
"%s"
"
$LUA_Email
:
$LUA_Key
"
| _base64
)
if
[
-z
"
$LUA_Key
"
]
||
[
-z
"
$LUA_Email
"
]
;
then
if
[
-z
"
$LUA_Key
"
]
||
[
-z
"
$LUA_Email
"
]
;
then
LUA_Key
=
""
LUA_Key
=
""
LUA_Email
=
""
LUA_Email
=
""
...
@@ -60,6 +61,7 @@ dns_lua_rm() {
...
@@ -60,6 +61,7 @@ dns_lua_rm() {
LUA_Key
=
"
${
LUA_Key
:-
$(
_readaccountconf_mutable LUA_Key
)
}
"
LUA_Key
=
"
${
LUA_Key
:-
$(
_readaccountconf_mutable LUA_Key
)
}
"
LUA_Email
=
"
${
LUA_Email
:-
$(
_readaccountconf_mutable LUA_Email
)
}
"
LUA_Email
=
"
${
LUA_Email
:-
$(
_readaccountconf_mutable LUA_Email
)
}
"
LUA_auth
=
$(
printf
"%s"
"
$LUA_Email
:
$LUA_Key
"
| _base64
)
_debug
"First detect the root zone"
_debug
"First detect the root zone"
if
!
_get_root
"
$fulldomain
"
;
then
if
!
_get_root
"
$fulldomain
"
;
then
_err
"invalid domain"
_err
"invalid domain"
...
...
dnsapi/dns_nsone.sh
View file @
b00919c6
...
@@ -59,10 +59,10 @@ dns_nsone_add() {
...
@@ -59,10 +59,10 @@ dns_nsone_add() {
_err
"Add txt record error."
_err
"Add txt record error."
else
else
_info
"Updating record"
_info
"Updating record"
re
cord_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
domain
\"
:
\"
$fulldomain
.
\"
,
[^{]*
\"
type
\"
:
\"
TXT
\"
,
\"
id
\"
:
\"
[^,]*
\
"
"
| _head_n 1 |
cut
-d
:
-f
7
|
cut
-d
,
-f1
)
p
re
v_txt
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
domain
\"
:
\"
$fulldomain
\"
,
\"
short_answers
\"
:
\[
\"
[^,]*
\
]
"
| _head_n 1 |
cut
-d
:
-f
3
|
cut
-d
,
-f1
)
_debug
"re
cord_id
"
"
$re
cord_id
"
_debug
"
p
re
v_txt
"
"
$
p
re
v_txt
"
_nsone_rest POST
"zones/
$_domain
/
$fulldomain
/TXT"
"{
\"
answers
\"
: [{
\"
answer
\"
: [
\"
$txtvalue
\"
]}],
\"
type
\"
:
\"
TXT
\"
,
\"
domain
\"
:
\"
$fulldomain
\"
,
\"
zone
\"
:
\"
$_domain
\"
}"
_nsone_rest POST
"zones/
$_domain
/
$fulldomain
/TXT"
"{
\"
answers
\"
: [{
\"
answer
\"
: [
\"
$txtvalue
\"
]}
,{
\"
answer
\"
:
$prev_txt
}
],
\"
type
\"
:
\"
TXT
\"
,
\"
domain
\"
:
\"
$fulldomain
\"
,
\"
zone
\"
:
\"
$_domain
\"
}"
if
[
"
$?
"
=
"0"
]
&&
_contains
"
$response
"
"
$fulldomain
"
;
then
if
[
"
$?
"
=
"0"
]
&&
_contains
"
$response
"
"
$fulldomain
"
;
then
_info
"Updated!"
_info
"Updated!"
#todo: check if the record takes effect
#todo: check if the record takes effect
...
...
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