mirror of https://github.com/jimsalterjrs/sanoid
improve dataset detection by only including mounted datasets
This commit is contained in:
parent
f745aa25a1
commit
0e5c2e1cff
9
findoid
9
findoid
|
|
@ -102,14 +102,19 @@ sub getdataset {
|
|||
|
||||
my ($path) = @_;
|
||||
|
||||
open FH, "$zfs list -Ho mountpoint |";
|
||||
open FH, "$zfs list -H -t filesystem -o mountpoint,mounted |";
|
||||
my @datasets = <FH>;
|
||||
close FH;
|
||||
|
||||
my @matchingdatasets;
|
||||
foreach my $dataset (@datasets) {
|
||||
chomp $dataset;
|
||||
if ( $path =~ /^$dataset/ ) { push @matchingdatasets, $dataset; }
|
||||
my ($mountpoint, $mounted) = ($dataset =~ m/([^\t]*)\t*(.*)/);
|
||||
if ($mounted ne "yes") {
|
||||
next;
|
||||
}
|
||||
|
||||
if ( $path =~ /^$mountpoint/ ) { push @matchingdatasets, $mountpoint; }
|
||||
}
|
||||
|
||||
my $bestmatch = '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue