]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add excludes read from config
authorBastian Dehn <hhaalo@arcor.de>
Wed, 17 Jun 2026 18:55:56 +0000 (20:55 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 17 Jun 2026 19:12:43 +0000 (21:12 +0200)
src/backup

index 6ffe60324e1d81d4271027b433e7db4f91466299..26f111a96f6d29e3b1e4f140fb8311e5ed88f326 100755 (executable)
@@ -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 \