From af290e0fe9409c67f32d642df16e2e429c986b90 Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Sat, 4 Mar 2023 20:25:47 +0100 Subject: [PATCH] Redesign auto-snapshot config --- bashclub-zsync/usr/bin/bashclub-zsync | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bashclub-zsync/usr/bin/bashclub-zsync b/bashclub-zsync/usr/bin/bashclub-zsync index 2c9b231..6290bde 100644 --- a/bashclub-zsync/usr/bin/bashclub-zsync +++ b/bashclub-zsync/usr/bin/bashclub-zsync @@ -122,7 +122,14 @@ for name in "${syncvols[@]}"; do for part in $(echo $target/$(echo $name | cut -d'/' -f1) | sed "s/\// /g"); do if [ $($zfs list $prefix$part > /dev/null 2>&1 ; echo $?) -gt 0 ]; then log "Creating $prefix$part" - $zfs create -o com.sun:auto-snapshot=false -p $prefix$part + if [[ $prefix/$part == $target ]]; then + autosnap=-ocom.sun:auto-snapshot=false + fi + $zfs create $autosnap -p $prefix$part + else + if [[ $prefix/$part == $target ]] && [[ $(zfs get -H -o value,source com.sun:auto-snapshot $prefix/$part) != "false local" ]]; then + $zfs set com.sun:auto-snapshot=false $prefix/$part + fi fi prefix="$prefix$part/" done