From 8bf90e27ef020b68be7cccbeb7cd07834d00451f Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 17 Jun 2026 20:55:56 +0200 Subject: [PATCH] add excludes read from config --- src/backup | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/backup b/src/backup index 6ffe603..26f111a 100755 --- a/src/backup +++ b/src/backup @@ -101,6 +101,23 @@ print_line() printf "\n" } +get_machine_excludes() +{ + local machine="$1" + local excludes=$(cat config.yaml \ + | yq --raw-output ".machines.\"$machine\".excludes[]") + + [ "$excludes" == "null" ] && return + [ -z "$excludes" ] && return + + local options="" + for exclude in $excludes; do + options=$(echo "$options --exclude=$exclude") + done + + echo "$options" +} + backup_remote_pathes() { local backup_path="$1" @@ -127,6 +144,7 @@ backup_remote_pathes() [ -n "$pathes" ] \ || errlog "config.yaml missing pathes for $machine" \ || return $? + local excludes=$(get_machine_excludes "$machine") local YELLOW="\e[0;33m" local LIGHTPURPLE="\e[1;35m" @@ -151,6 +169,7 @@ backup_remote_pathes() --hard-links \ --relative \ --human-readable \ + $excludes \ $hardlinkopt \ --rsh "ssh -p $port" \ $hostpath \ -- 2.47.3