From e93096c2d943b3052117f15e547e8673db0d6ac0 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Tue, 3 Apr 2018 23:36:28 +0200 Subject: [PATCH] Fix recursive snapshots for datasets with noauto descendants Fixes #80 --- src/zfs-auto-snapshot.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/zfs-auto-snapshot.sh diff --git a/src/zfs-auto-snapshot.sh b/src/zfs-auto-snapshot.sh old mode 100755 new mode 100644 index 5ef5bae..be81fcf --- a/src/zfs-auto-snapshot.sh +++ b/src/zfs-auto-snapshot.sh @@ -440,11 +440,16 @@ do # Just testing "$ii" != ${ii#$jj} would incorrectly match. iii="$ii/" - # Exclude datasets that are not named on the command line. + # Exclude datasets + # * that are not named on the command line or + # * those whose prefix is not on the command line (if --recursive flag is set) IN_ARGS='0' for jj in "$@" do if [ "$jj" = '//' -o "$jj" = "$ii" ] + then + IN_ARGS=$(( $IN_ARGS + 1 )) + elif [ -n "$opt_recursive" -a "$iii" != "${iii#$jj}" ] then IN_ARGS=$(( $IN_ARGS + 1 )) fi