fix: use default value for unset passphrase parameter to prevent error
Update the script to reference the 12th parameter as ${12:-} instead of ${12} when checking for a passphrase. This change prevents the script from failing with a "parameter not set" error under set -u if the passphrase is not provided.
pull/63/head
v1.2.6
parent
b131f3d078
commit
a5ccb9c621
|
|
@ -84,7 +84,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if passphrase is set, if yes decrypt the private key
|
# check if passphrase is set, if yes decrypt the private key
|
||||||
if [ -n "${12}" ]; then
|
if [ -n "${12:-}" ]; then
|
||||||
echo 'Use ssh-agent to decrypt private key with passphrase'
|
echo 'Use ssh-agent to decrypt private key with passphrase'
|
||||||
# start ssh agent
|
# start ssh agent
|
||||||
eval $(ssh-agent -s)
|
eval $(ssh-agent -s)
|
||||||
|
|
@ -105,7 +105,7 @@ sftp -b $TEMP_SFTP_FILE -P $3 $8 -o StrictHostKeyChecking=no -i $TEMP_SSH_PRIVAT
|
||||||
|
|
||||||
echo 'Deploy Success'
|
echo 'Deploy Success'
|
||||||
# if passphrase is set stop ssh-agent after sftp connection
|
# if passphrase is set stop ssh-agent after sftp connection
|
||||||
if [ -n "${12}" ]; then
|
if [ -n "${12:-}" ]; then
|
||||||
echo 'Clear keys from ssh-agent'
|
echo 'Clear keys from ssh-agent'
|
||||||
# delete all keys from RAM
|
# delete all keys from RAM
|
||||||
ssh-add -D
|
ssh-add -D
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue