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
08d60fcb
Commit
08d60fcb
authored
Aug 30, 2021
by
fradev
Browse files
Update ssh.sh
shfmt formatting
parent
4cda5477
Changes
1
Show whitespace changes
Inline
Side-by-side
deploy/ssh.sh
View file @
08d60fcb
...
@@ -93,7 +93,6 @@ ssh_deploy() {
...
@@ -93,7 +93,6 @@ ssh_deploy() {
Le_Deploy_ssh_scp_cmd
=
"scp -T"
Le_Deploy_ssh_scp_cmd
=
"scp -T"
fi
fi
# BACKUP is optional. If not provided then default to previously saved value or yes.
# BACKUP is optional. If not provided then default to previously saved value or yes.
if
[
"
$DEPLOY_SSH_BACKUP
"
=
"no"
]
;
then
if
[
"
$DEPLOY_SSH_BACKUP
"
=
"no"
]
;
then
Le_Deploy_ssh_backup
=
"no"
Le_Deploy_ssh_backup
=
"no"
...
@@ -206,7 +205,6 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
...
@@ -206,7 +205,6 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
fi
fi
fi
fi
# copy new key into file.
# copy new key into file.
if
[
"
$Le_Deploy_ssh_use_scp
"
=
"yes"
]
;
then
if
[
"
$Le_Deploy_ssh_use_scp
"
=
"yes"
]
;
then
# scp the file
# scp the file
...
@@ -237,8 +235,8 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
...
@@ -237,8 +235,8 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
# if filename is same as previous file then append.
# if filename is same as previous file then append.
_pipe
=
">>"
_pipe
=
">>"
_local_cert_file
=
$(
_mktemp
)
_local_cert_file
=
$(
_mktemp
)
cat
"
$_ckey
"
>
"
$_local_cert_file
"
cat
"
$_ckey
"
>
"
$_local_cert_file
"
cat
"
$_ccert
"
>>
"
$_local_cert_file
"
cat
"
$_ccert
"
>>
"
$_local_cert_file
"
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
# backup file we are about to overwrite.
# backup file we are about to overwrite.
_cmdstr
=
"
$_cmdstr
cp
$Le_Deploy_ssh_certfile
$_backupdir
>/dev/null;"
_cmdstr
=
"
$_cmdstr
cp
$Le_Deploy_ssh_certfile
$_backupdir
>/dev/null;"
...
@@ -286,14 +284,14 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
...
@@ -286,14 +284,14 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
# if filename is same as previous file then append.
# if filename is same as previous file then append.
_pipe
=
">>"
_pipe
=
">>"
_local_ca_file
=
$(
_mktemp
)
_local_ca_file
=
$(
_mktemp
)
if
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_keyfile
"
]
;
then
if
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_keyfile
"
]
;
then
cat
"
$_ckey
"
>>
"
$_local_ca_file
"
cat
"
$_ckey
"
>>
"
$_local_ca_file
"
fi
fi
if
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_certfile
"
]
;
then
if
[
"
$Le_Deploy_ssh_cafile
"
=
"
$Le_Deploy_ssh_certfile
"
]
;
then
cat
"
$_ccert
"
>>
"
$_local_ca_file
"
cat
"
$_ccert
"
>>
"
$_local_ca_file
"
fi
fi
cat
"
$_cca
"
>>
"
$_local_ca_file
"
cat
"
$_cca
"
>>
"
$_local_ca_file
"
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
# backup file we are about to overwrite.
# backup file we are about to overwrite.
...
@@ -343,16 +341,16 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
...
@@ -343,16 +341,16 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
# if filename is same as previous file then append.
# if filename is same as previous file then append.
_pipe
=
">>"
_pipe
=
">>"
_local_full_file
=
$(
_mktemp
)
_local_full_file
=
$(
_mktemp
)
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_keyfile
"
]
;
then
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_keyfile
"
]
;
then
cat
"
$_ckey
"
>>
"
$_local_full_file
"
cat
"
$_ckey
"
>>
"
$_local_full_file
"
fi
fi
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_certfile
"
]
;
then
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_certfile
"
]
;
then
cat
"
$_ccert
"
>>
"
$_local_full_file
"
cat
"
$_ccert
"
>>
"
$_local_full_file
"
fi
fi
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_cafile
"
]
;
then
if
[
"
$Le_Deploy_ssh_fullchain
"
=
"
$Le_Deploy_ssh_cafile
"
]
;
then
cat
"
$_cca
"
>>
"
$_local_full_file
"
cat
"
$_cca
"
>>
"
$_local_full_file
"
fi
fi
cat
"
$_cfullchain
"
>>
"
$_local_full_file
"
cat
"
$_cfullchain
"
>>
"
$_local_full_file
"
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
elif
[
"
$Le_Deploy_ssh_backup
"
=
"yes"
]
;
then
# backup file we are about to overwrite.
# backup file we are about to overwrite.
...
@@ -366,7 +364,7 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
...
@@ -366,7 +364,7 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
fi
fi
if
[
"
$Le_Deploy_ssh_use_scp
"
=
"yes"
]
;
then
if
[
"
$Le_Deploy_ssh_use_scp
"
=
"yes"
]
;
then
if
[
-n
"
$_local_full_file
"
]
;
then
if
[
-n
"
$_local_full_file
"
]
;
then
if
!
_scp_remote_cmd
"
$_local_full_file
"
"
$Le_Deploy_ssh_fullchain
"
;
then
if
!
_scp_remote_cmd
"
$_local_full_file
"
"
$Le_Deploy_ssh_fullchain
"
;
then
return
$_err_code
return
$_err_code
fi
fi
...
@@ -390,16 +388,15 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
...
@@ -390,16 +388,15 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
# cleanup local files if any
# cleanup local files if any
if
[
-n
"
$_local_cert_file
"
]
;
then
if
[
-n
"
$_local_cert_file
"
]
;
then
rm
"
$_local_cert_file
"
>
/dev/null 1>&2
rm
"
$_local_cert_file
"
>
/dev/null 1>&2
fi
fi
if
[
-n
"
$_local_ca_file
"
]
;
then
if
[
-n
"
$_local_ca_file
"
]
;
then
rm
"
$_local_ca_file
"
>
/dev/null 1>&2
rm
"
$_local_ca_file
"
>
/dev/null 1>&2
fi
fi
if
[
-n
"
$_local_full_file
"
]
;
then
if
[
-n
"
$_local_full_file
"
]
;
then
rm
"
$_local_full_file
"
>
/dev/null 1>&2
rm
"
$_local_full_file
"
>
/dev/null 1>&2
fi
fi
# REMOTE_CMD is optional.
# REMOTE_CMD is optional.
# If provided then this command will be executed on remote host.
# If provided then this command will be executed on remote host.
if
[
-n
"
$DEPLOY_SSH_REMOTE_CMD
"
]
;
then
if
[
-n
"
$DEPLOY_SSH_REMOTE_CMD
"
]
;
then
...
...
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