From: Bastian Dehn Date: Wed, 17 Jun 2026 18:55:56 +0000 (+0200) Subject: add excludes read from config X-Git-Tag: v1.0.3^2~2^2~2 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=8bf90e27ef020b68be7cccbeb7cd07834d00451f;p=simple-backup.git add excludes read from config --- 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 \