Add PLUGIN_FTP_USERNAME & PLUGIN_FTP_PASSWORD

This commit is contained in:
rubenelshof 2022-10-28 13:48:19 +02:00 committed by Pierre-Olivier Mercier
parent 7f20f9eb2c
commit db24bc0bdd

View File

@ -1,10 +1,16 @@
#!/bin/bash #!/bin/bash
if [ -z "$FTP_USERNAME" ]; then if [[ -z "$FTP_USERNAME" && -z "$PLUGIN_FTP_USERNAME" ]]; then
echo "Need to set username" echo "Need to set username"
exit 1 exit 1
fi fi
FTP_USERNAME_STR=""
FTP_PASSWORD_STR=""
[ -n "$PLUGIN_FTP_USERNAME" ] && FTP_USERNAME_STR="$PLUGIN_FTP_USERNAME" || FTP_USERNAME_STR="$FTP_USERNAME"
[ -n "$PLUGIN_FTP_PASSWORD" ] && FTP_PASSWORD_STR="$PLUGIN_FTP_PASSWORD" || FTP_PASSWORD_STR="$FTP_PASSWORD"
if [ -z "$PLUGIN_HOSTNAME" ]; then if [ -z "$PLUGIN_HOSTNAME" ]; then
echo "Need to set hostname" echo "Need to set hostname"
exit 1 exit 1
@ -84,4 +90,4 @@ lftp $PLUGIN_DEBUG -e "set xfer:log 1; \
$PLUGIN_CLEAN_DIR; \ $PLUGIN_CLEAN_DIR; \
mirror --verbose $PLUGIN_CHMOD -R $PLUGIN_ONLY_NEWER $PLUGIN_MIRROR_OPTS $PLUGIN_INCLUDE_STR $PLUGIN_EXCLUDE_STR $(pwd)$PLUGIN_SRC_DIR $PLUGIN_DEST_DIR; \ mirror --verbose $PLUGIN_CHMOD -R $PLUGIN_ONLY_NEWER $PLUGIN_MIRROR_OPTS $PLUGIN_INCLUDE_STR $PLUGIN_EXCLUDE_STR $(pwd)$PLUGIN_SRC_DIR $PLUGIN_DEST_DIR; \
$PLUGIN_POST_ACTION;" \ $PLUGIN_POST_ACTION;" \
-u $FTP_USERNAME,$FTP_PASSWORD $PLUGIN_HOSTNAME -u "$FTP_USERNAME_STR","$FTP_PASSWORD_STR" "$PLUGIN_HOSTNAME"