From 4f1c4b64e2f7da2d28694821d8af575d97a5bb5a Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 28 Jun 2026 10:50:56 +0200 Subject: [PATCH] fix rsync args all in loop --- src/backup | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/backup b/src/backup index c4767b2..65b5b2f 100755 --- a/src/backup +++ b/src/backup @@ -116,13 +116,7 @@ backup_remote_pathes() local YELLOW="\e[0;33m" local LIGHTPURPLE="\e[1;35m" local RESET="\e[0m" - local rsyncargs=("--archive" \ - "--verbose" \ - "--sparse" - "--acls" \ - "--hard-links" \ - "--relative" \ - "--human-readable") + local rsyncargs=() remote_user=$(yq \ --raw-output ".machines.\"$machine\".remote_user" config.yaml) @@ -145,13 +139,6 @@ backup_remote_pathes() config.yaml \ 2> /dev/null) - if [ "$excludes" != "null" ]; then - local exclude= - for exclude in $excludes; do - rsyncargs+=("--exclude=$exclude") - done - fi - rsyncargs+=("--rsh=ssh -p $port") local path= for path in $pathes; do @@ -159,6 +146,22 @@ backup_remote_pathes() printf "ℹ️ INFO: machine ${LIGHTPURPLE}%s${RESET}; " "$machine" printf "path ${YELLOW}%s${RESET}\n\n" "$path" + rsyncargs=("--archive" + "--verbose" + "--sparse" + "--acls" + "--hard-links" + "--relative" + "--human-readable") + + if [ "$excludes" != "null" ]; then + local exclude= + for exclude in $excludes; do + rsyncargs+=("--exclude=$exclude") + done + fi + rsyncargs+=("--rsh=ssh -p $port") + [ -n "$last_backup_dir_path" ] \ && rsyncargs+=("--link-dest=$last_backup_dir_path/$machine") -- 2.47.3