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
42827be7
Unverified
Commit
42827be7
authored
Jan 12, 2024
by
laraveluser
Committed by
GitHub
Jan 12, 2024
Browse files
Update dns_limacity.sh
parent
7022d27b
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_limacity.sh
View file @
42827be7
...
...
@@ -59,35 +59,36 @@ dns_limacity_rm() {
#################### Private functions below ##################################
_lima_get_root
()
{
_lima_get_root
=
$1
i
=
1
_lima_get_domain_id
()
{
domain
=
"
$1
"
_debug
"
$domain
"
i
=
2
p
=
1
response
=
$(
_get
"
${
APIBASE
}
/domains.json"
)
if
"
$response
"
;
then
response
=
"
$(
echo
"
$response
"
|
tr
-d
"
\n
"
|
tr
'{'
"|"
|
sed
's/|/&{/g'
|
tr
"|"
"
\n
"
)
"
while
true
;
do
h
=
$(
printf
"%s"
"
$
_lima_get_root
"
|
cut
-d
.
-f
`
_math
"
$i
"
-100
`
)
h
=
$(
printf
"%s"
"
$
domain
"
|
cut
-d
.
-f
$i
-100
)
_debug h
"
$h
"
if
[
-z
"
$h
"
]
;
then
#not valid
return
0
return
1
fi
if
_contains
"
$h
"
"
\.
"
;
then
domain
=
$h
hostedzone
=
"
$(
echo
"
$response
"
| _egrep_o
"{.*
\"
domain
\"
:
\s
*
\"
$h
\"
.*}"
)
"
if
[
"
$hostedzone
"
]
;
then
LIMACITY_DOMAINID
=
$(
printf
"%s
\n
"
"
$hostedzone
"
| _egrep_o
"
\"
id
\"
:
\s
*[0-9]+"
| _head_n 1 |
cut
-d
:
-f
2 |
tr
-d
\
)
if
[
"
$LIMACITY_DOMAINID
"
]
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_domain
=
$h
return
0
fi
return
1
fi
p
=
$i
i
=
$(
_math
"
$i
"
+ 1
)
done
}
_lima_get_domain_id
()
{
_lima_get_root
"
$1
"
_debug
"
$domain
"
LIMACITY_DOMAINID
=
$(
_get
"
${
APIBASE
}
/domains.json"
| _egrep_o
":[0-9]*[^}]*
$domain
"
| _egrep_o
"[0-9]*"
)
_debug
"
$LIMACITY_DOMAINID
"
if
[
-z
"
$LIMACITY_DOMAINID
"
]
;
then
return
1
fi
return
0
return
1
}
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