Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
95769de4
Unverified
Commit
95769de4
authored
Feb 09, 2020
by
Brian Hartvigsen
Browse files
Fix shfmt/shellcheck issues
parent
52a168b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/synology_dsm.sh
View file @
95769de4
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
_syno_get_cookie_data
()
{
_syno_get_cookie_data
()
{
_debug2 Cookie
"
$1
"
_debug2 Cookie
"
$1
"
_debug3
grep
"
$(
grep
"
\W
$1
="
"
$HTTP_HEADER
"
|
grep
"^Set-Cookie:"
| _tail_n 1 | _egrep_o
"
$1
=[^;]*;"
|
tr
-d
';'
)
"
_debug3
grep
"
$(
grep
"
\W
$1
="
"
$HTTP_HEADER
"
|
grep
"^Set-Cookie:"
| _tail_n 1 | _egrep_o
"
$1
=[^;]*;"
|
tr
-d
';'
)
"
grep
"
\W
$1
="
"
$HTTP_HEADER
"
|
grep
"^Set-Cookie:"
| _tail_n 1 | _egrep_o
"
$1
=[^;]*;"
|
tr
-d
';'
grep
"
\W
$1
="
"
$HTTP_HEADER
"
|
grep
"^Set-Cookie:"
| _tail_n 1 | _egrep_o
"
$1
=[^;]*;"
|
tr
-d
';'
}
}
...
@@ -105,7 +105,7 @@ synology_dsm_deploy() {
...
@@ -105,7 +105,7 @@ synology_dsm_deploy() {
_info
"Getting certificates in Synology DSM"
_info
"Getting certificates in Synology DSM"
response
=
$(
_post
"api=SYNO.Core.Certificate.CRT&method=list&version=1"
"
$_base_url
/webapi/entry.cgi"
)
response
=
$(
_post
"api=SYNO.Core.Certificate.CRT&method=list&version=1"
"
$_base_url
/webapi/entry.cgi"
)
_debug3 response
"
$response
"
_debug3 response
"
$response
"
id
=
$(
printf
"
$response
"
|
sed
-n
"s/.*
\"
desc
\"
:
\"
$SYNO_Certificate
\"
,
\"
id
\"
:
\"\(
[^
\"
]*
\)
.*/
\1
/p"
)
id
=
$(
echo
"
$response
"
|
sed
-n
"s/.*
\"
desc
\"
:
\"
$SYNO_Certificate
\"
,
\"
id
\"
:
\"\(
[^
\"
]*
\)
.*/
\1
/p"
)
_debug2
id
"
$id
"
_debug2
id
"
$id
"
if
[
-z
"
$id
"
]
;
then
if
[
-z
"
$id
"
]
;
then
...
@@ -117,8 +117,8 @@ synology_dsm_deploy() {
...
@@ -117,8 +117,8 @@ synology_dsm_deploy() {
_savedeployconf SYNO_Certificate
"
$SYNO_Certificate
"
_savedeployconf SYNO_Certificate
"
$SYNO_Certificate
"
default
=
false
default
=
false
if
printf
"
$response
"
|
sed
-n
"s/.*
\"
desc
\"
:
\"
$SYNO_Certificate
\"
,
\(
[^{]*
\)
.*/
\1
/p"
|
grep
-q
--
'is_default":true'
;
then
if
echo
"
$response
"
|
sed
-n
"s/.*
\"
desc
\"
:
\"
$SYNO_Certificate
\"
,
\(
[^{]*
\)
.*/
\1
/p"
|
grep
-q
--
'is_default":true'
;
then
default
=
true
default
=
true
fi
fi
_debug2 default
"
$default
"
_debug2 default
"
$default
"
...
@@ -132,14 +132,15 @@ synology_dsm_deploy() {
...
@@ -132,14 +132,15 @@ synology_dsm_deploy() {
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
desc
\"
${
nl
}${
nl
}${
SYNO_Certificate
}
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
desc
\"
${
nl
}${
nl
}${
SYNO_Certificate
}
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
as_default
\"
${
nl
}${
nl
}${
default
}
"
content
=
"
$content
${
nl
}
--
$delim
${
nl
}
Content-Disposition: form-data; name=
\"
as_default
\"
${
nl
}${
nl
}${
default
}
"
content
=
"
$content
${
nl
}
--
$delim
--
${
nl
}
"
content
=
"
$content
${
nl
}
--
$delim
--
${
nl
}
"
content
=
"
$(
printf
"%b_"
"
$content
"
)
"
;
content
=
"
${
content
%_
}
"
# protect trailing \n
content
=
"
$(
printf
"%b_"
"
$content
"
)
"
content
=
"
${
content
%_
}
"
# protect trailing \n
_info
"Upload certificate to the Synology DSM"
_info
"Upload certificate to the Synology DSM"
response
=
$(
_post
"
$content
"
"
$_base_url
/webapi/entry.cgi?api=SYNO.Core.Certificate&method=import&version=1&SynoToken=
$token
"
""
"POST"
"multipart/form-data; boundary=
${
delim
}
"
)
response
=
$(
_post
"
$content
"
"
$_base_url
/webapi/entry.cgi?api=SYNO.Core.Certificate&method=import&version=1&SynoToken=
$token
"
""
"POST"
"multipart/form-data; boundary=
${
delim
}
"
)
_debug3 response
"
$response
"
_debug3 response
"
$response
"
if
!
printf
"
$response
"
|
grep
-q
'"error":'
;
then
if
!
echo
"
$response
"
|
grep
-q
'"error":'
;
then
if
printf
"
$response
"
|
grep
-q
'"restart_httpd":true'
;
then
if
echo
"
$response
"
|
grep
-q
'"restart_httpd":true'
;
then
_info
"http services were restarted"
_info
"http services were restarted"
else
else
_info
"http services were NOT restarted"
_info
"http services were NOT restarted"
...
...
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