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
70b49980
Commit
70b49980
authored
Aug 09, 2020
by
neil
Browse files
fix format
parent
a2d872a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_dynv6.sh
View file @
70b49980
...
@@ -80,7 +80,7 @@ _generate_new_key() {
...
@@ -80,7 +80,7 @@ _generate_new_key() {
_get_domain
()
{
_get_domain
()
{
_full_domain
=
"
$1
"
_full_domain
=
"
$1
"
_debug
"getting domain for
$_full_domain
"
_debug
"getting domain for
$_full_domain
"
if
!
_contains
"
$_full_domain
"
'dynv6.net'
&&
!
_contains
"
$_full_domain
"
'dns.army'
&&
!
_contains
"
$_full_domain
"
'dns.navy'
&&
!
_contains
"
$_full_domain
"
'v6.rocks'
;
then
if
!
_contains
"
$_full_domain
"
'dynv6.net'
&&
!
_contains
"
$_full_domain
"
'dns.army'
&&
!
_contains
"
$_full_domain
"
'dns.navy'
&&
!
_contains
"
$_full_domain
"
'v6.rocks'
;
then
_err
"The hosts does not seem to be a dynv6 host"
_err
"The hosts does not seem to be a dynv6 host"
return
1
return
1
fi
fi
...
...
dnsapi/dns_netlify.sh
View file @
70b49980
...
@@ -57,6 +57,8 @@ dns_netlify_add() {
...
@@ -57,6 +57,8 @@ dns_netlify_add() {
#Remove the txt record after validation.
#Remove the txt record after validation.
dns_netlify_rm
()
{
dns_netlify_rm
()
{
_info
"Using Netlify"
_info
"Using Netlify"
txtdomain
=
"
$1
"
txt
=
"
$2
"
_debug txtdomain
"
$txtdomain
"
_debug txtdomain
"
$txtdomain
"
_debug txt
"
$txt
"
_debug txt
"
$txt
"
...
@@ -70,12 +72,12 @@ dns_netlify_rm() {
...
@@ -70,12 +72,12 @@ dns_netlify_rm() {
_debug _domain_id
"
$_domain_id
"
_debug _domain_id
"
$_domain_id
"
_debug _sub_domain
"
$_sub_domain
"
_debug _sub_domain
"
$_sub_domain
"
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
dnsRecordURI
=
"dns_zones/
$_domain_id
/dns_records"
dnsRecordURI
=
"dns_zones/
$_domain_id
/dns_records"
_netlify_rest GET
"
$dnsRecordURI
"
""
"
$NETLIFY_ACCESS_TOKEN
"
_netlify_rest GET
"
$dnsRecordURI
"
""
"
$NETLIFY_ACCESS_TOKEN
"
_record_id
=
$(
echo
"
$response
"
| _egrep_o
"
\"
type
\"
:
\"
TXT
\"
,[^
\}
]*
\"
value
\"
:
\"
$txt
\"
"
|
head
-n
1 | _egrep_o
"
\"
id
\"
:
\"
[^
\"\}
]*
\"
"
|
cut
-d
:
-f
2 |
tr
-d
\"
)
_record_id
=
$(
echo
"
$response
"
| _egrep_o
"
\"
type
\"
:
\"
TXT
\"
,[^
\}
]*
\"
value
\"
:
\"
$txt
\"
"
|
head
-n
1 | _egrep_o
"
\"
id
\"
:
\"
[^
\"\}
]*
\"
"
|
cut
-d
:
-f
2 |
tr
-d
\"
)
_debug _record_id
"
$_record_id
"
_debug _record_id
"
$_record_id
"
if
[
"
$_record_id
"
]
;
then
if
[
"
$_record_id
"
]
;
then
_netlify_rest DELETE
"
$dnsRecordURI
/
$_record_id
"
""
"
$NETLIFY_ACCESS_TOKEN
"
_netlify_rest DELETE
"
$dnsRecordURI
/
$_record_id
"
""
"
$NETLIFY_ACCESS_TOKEN
"
...
@@ -101,7 +103,7 @@ _get_root() {
...
@@ -101,7 +103,7 @@ _get_root() {
p
=
1
p
=
1
_netlify_rest GET
"dns_zones"
""
"
$accesstoken
"
_netlify_rest GET
"dns_zones"
""
"
$accesstoken
"
while
true
;
do
while
true
;
do
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
_debug2
"Checking domain:
$h
"
_debug2
"Checking domain:
$h
"
...
@@ -112,7 +114,7 @@ _get_root() {
...
@@ -112,7 +114,7 @@ _get_root() {
fi
fi
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
>
/dev/null
;
then
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
>
/dev/null
;
then
_domain_id
=
$(
echo
"
$response
"
| _egrep_o
"
\"
[^
\"
]*
\"
,
\"
name
\"
:
\"
$h
"
|
cut
-d
,
-f
1 |
tr
-d
\"
)
_domain_id
=
$(
echo
"
$response
"
| _egrep_o
"
\"
[^
\"
]*
\"
,
\"
name
\"
:
\"
$h
"
|
cut
-d
,
-f
1 |
tr
-d
\"
)
if
[
"
$_domain_id
"
]
;
then
if
[
"
$_domain_id
"
]
;
then
if
[
"
$i
"
=
1
]
;
then
if
[
"
$i
"
=
1
]
;
then
#create the record at the domain apex (@) if only the domain name was provided as --domain-alias
#create the record at the domain apex (@) if only the domain name was provided as --domain-alias
...
@@ -157,4 +159,4 @@ _netlify_rest() {
...
@@ -157,4 +159,4 @@ _netlify_rest() {
fi
fi
_debug2 response
"
$response
"
_debug2 response
"
$response
"
return
0
return
0
}
}
\ No newline at end of file
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