From 252086e2e6cd62dee7f21a40e9f5db2e6009df31 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sun, 17 May 2020 22:01:12 +0200 Subject: [PATCH] another option that is unsupported in older versions --- bin/zfs-autobackup | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/zfs-autobackup b/bin/zfs-autobackup index 8b2c457..79da5df 100755 --- a/bin/zfs-autobackup +++ b/bin/zfs-autobackup @@ -990,7 +990,7 @@ class ZfsDataset(): #verbose output cmd.append("-v") - if 'extensible_dataset' in features: + if 'extensible_dataset' in features and "-s" in self.zfs_node.supported_recv_options: #support resuming self.debug("Enabled resume support") cmd.append("-s") @@ -1355,6 +1355,17 @@ class ZfsNode(ExecuteNode): ret.append(option) return(ret) + @cached_property + def supported_recv_options(self): + """list of supported options""" + #not every zfs implementation supports them all + + ret=[] + for option in ["-s" ]: + if self.valid_command(["zfs","recv", option, "zfs_autobackup_option_test"]): + ret.append(option) + return(ret) + def valid_command(self, cmd): """test if a specified zfs options are valid exit code. use this to determine support options"""