support multiple sources

Ricard Illa 2022-08-22 16:19:14 +02:00
parent 6d8109d9a0
commit 6bbe478ef1
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 8 additions and 4 deletions

View File

@ -20,9 +20,10 @@ fi
KNOWN_HOSTS="${KNOWN_HOSTS:=${PLUGIN_KNOWN_HOSTS}}"
SOURCE="${SOURCE:-${PLUGIN_SOURCE}}"
if [ -z "$SOURCE" ]; then
echo "'source' must be specified"
SOURCES="${SOURCES:-${PLUGIN_SOURCES}}"
SOURCES=$(echo "$SOURCES" | tr ',' ' ')
if [ -z "$SOURCES" ]; then
echo "specify at least one source"
exit 1
fi
@ -48,4 +49,7 @@ known_hosts_file="${HOME}/.ssh/known_hosts"
# run rsync
# shellcheck disable=SC2086
exec rsync $ARGS "${SOURCE}" "${USER}"@"${HOST}":"${TARGET}"
for SOURCE in $SOURCES; do
echo "copying '$SOURCE' to '$TARGET'"
rsync $ARGS "${SOURCE}" "${USER}"@"${HOST}":"${TARGET}"
done