From a5ccb9c6211a94cc59404f0fdb2a9936a6dfee64 Mon Sep 17 00:00:00 2001 From: wl <356485255@qq.com> Date: Wed, 16 Apr 2025 10:41:35 +0800 Subject: [PATCH] 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. --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a980b1e..3b59522 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -84,7 +84,7 @@ else fi # 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' # start ssh agent 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' # if passphrase is set stop ssh-agent after sftp connection -if [ -n "${12}" ]; then +if [ -n "${12:-}" ]; then echo 'Clear keys from ssh-agent' # delete all keys from RAM ssh-add -D