mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-27 07:21:53 +00:00
Update ssh.sh
shfmt formatting
This commit is contained in:
parent
4cda54774a
commit
08d60fcbf2
@ -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,12 +205,11 @@ 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
|
||||||
if ! _scp_remote_cmd "$_ckey" "$Le_Deploy_ssh_keyfile"; then
|
if ! _scp_remote_cmd "$_ckey" "$Le_Deploy_ssh_keyfile"; then
|
||||||
return $_err_code
|
return $_err_code
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_cmdstr="$_cmdstr echo \"$(cat "$_ckey")\" > $Le_Deploy_ssh_keyfile;"
|
_cmdstr="$_cmdstr echo \"$(cat "$_ckey")\" > $Le_Deploy_ssh_keyfile;"
|
||||||
@ -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;"
|
||||||
@ -253,11 +251,11 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
|
|||||||
if [ "$Le_Deploy_ssh_use_scp" = "yes" ]; then
|
if [ "$Le_Deploy_ssh_use_scp" = "yes" ]; then
|
||||||
if [ -n "$_local_cert_file" ]; then
|
if [ -n "$_local_cert_file" ]; then
|
||||||
if ! _scp_remote_cmd "$_local_cert_file" "$Le_Deploy_ssh_certfile"; then
|
if ! _scp_remote_cmd "$_local_cert_file" "$Le_Deploy_ssh_certfile"; then
|
||||||
return $_err_code
|
return $_err_code
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! _scp_remote_cmd "$_ccert" "$Le_Deploy_ssh_certfile"; then
|
if ! _scp_remote_cmd "$_ccert" "$Le_Deploy_ssh_certfile"; then
|
||||||
return $_err_code
|
return $_err_code
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -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.
|
||||||
@ -309,11 +307,11 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
|
|||||||
if [ "$Le_Deploy_ssh_use_scp" = "yes" ]; then
|
if [ "$Le_Deploy_ssh_use_scp" = "yes" ]; then
|
||||||
if [ -n "$_local_ca_file" ]; then
|
if [ -n "$_local_ca_file" ]; then
|
||||||
if ! _scp_remote_cmd "$_local_ca_file" "$Le_Deploy_ssh_cafile"; then
|
if ! _scp_remote_cmd "$_local_ca_file" "$Le_Deploy_ssh_cafile"; then
|
||||||
return $_err_code
|
return $_err_code
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! _scp_remote_cmd "$_cca" "$Le_Deploy_ssh_cafile"; then
|
if ! _scp_remote_cmd "$_cca" "$Le_Deploy_ssh_cafile"; then
|
||||||
return $_err_code
|
return $_err_code
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -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,13 +364,13 @@ 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
|
||||||
else
|
else
|
||||||
if ! _scp_remote_cmd "$_cfullchain" "$Le_Deploy_ssh_fullchain"; then
|
if ! _scp_remote_cmd "$_cfullchain" "$Le_Deploy_ssh_fullchain"; then
|
||||||
return $_err_code
|
return $_err_code
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user