Fixup bug with zfs replication
This commit is contained in:
parent
cfacbff288
commit
9ccd312419
3 changed files with 82 additions and 0 deletions
|
|
@ -43,6 +43,7 @@
|
|||
system = "x86_64-linux";
|
||||
specialArgs = { inherit unstablePkgs updatePkgs nixos-hardware; };
|
||||
modules = [
|
||||
{ nixpkgs.overlays = [ (import ./overlays/zfs-replicate.nix) ]; }
|
||||
./hosts/axl/configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
|
|
|
|||
74
overlays/zfs-replicate-env-fix.patch
Normal file
74
overlays/zfs-replicate-env-fix.patch
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
diff --git a/zfs/replicate/filesystem/create.py b/zfs/replicate/filesystem/create.py
|
||||
index 0349159..f98831c 100644
|
||||
--- a/zfs/replicate/filesystem/create.py
|
||||
+++ b/zfs/replicate/filesystem/create.py
|
||||
@@ -50,4 +50,4 @@ def create(filesystem: FileSystem, ssh_command: str) -> None:
|
||||
|
||||
|
||||
def _create(filesystem: str) -> str:
|
||||
- return f"/usr/bin/env - zfs create -o readonly=on {filesystem}"
|
||||
+ return f"/usr/bin/env zfs create -o readonly=on {filesystem}"
|
||||
diff --git a/zfs/replicate/filesystem/destroy.py b/zfs/replicate/filesystem/destroy.py
|
||||
index 7e590d5..dd1b75a 100644
|
||||
--- a/zfs/replicate/filesystem/destroy.py
|
||||
+++ b/zfs/replicate/filesystem/destroy.py
|
||||
@@ -21,4 +21,4 @@ def destroy(filesystem: FileSystem, ssh_command: str) -> None:
|
||||
|
||||
|
||||
def _destroy(filesystem: FileSystem) -> str:
|
||||
- return f"/usr/bin/env - zfs destroy -r '{filesystem}'"
|
||||
+ return f"/usr/bin/env zfs destroy -r '{filesystem}'"
|
||||
diff --git a/zfs/replicate/filesystem/list.py b/zfs/replicate/filesystem/list.py
|
||||
index 5e892e6..f33e11e 100644
|
||||
--- a/zfs/replicate/filesystem/list.py
|
||||
+++ b/zfs/replicate/filesystem/list.py
|
||||
@@ -42,7 +42,7 @@ def list( # pylint: disable=W0622
|
||||
def _list(filesystem: FileSystem) -> str:
|
||||
options = ["-H", "-o name,readonly", "-t filesystem,volume", "-r"]
|
||||
|
||||
- return f"/usr/bin/env - zfs list {' '.join(options)} '{filesystem.name}'"
|
||||
+ return f"/usr/bin/env zfs list {' '.join(options)} '{filesystem.name}'"
|
||||
|
||||
|
||||
def _filesystems(zfs_list_output: bytes) -> List[FileSystem]:
|
||||
diff --git a/zfs/replicate/snapshot/destroy.py b/zfs/replicate/snapshot/destroy.py
|
||||
index a2558b1..2a92360 100644
|
||||
--- a/zfs/replicate/snapshot/destroy.py
|
||||
+++ b/zfs/replicate/snapshot/destroy.py
|
||||
@@ -21,4 +21,4 @@ def destroy(snapshot: Snapshot, ssh_command: str) -> None:
|
||||
|
||||
|
||||
def _destroy(snapshot: Snapshot) -> str:
|
||||
- return f"/usr/bin/env - zfs destroy '{snapshot.filesystem.name}@{snapshot.name}'"
|
||||
+ return f"/usr/bin/env zfs destroy '{snapshot.filesystem.name}@{snapshot.name}'"
|
||||
diff --git a/zfs/replicate/snapshot/list.py b/zfs/replicate/snapshot/list.py
|
||||
index 033f6ee..c29abac 100644
|
||||
--- a/zfs/replicate/snapshot/list.py
|
||||
+++ b/zfs/replicate/snapshot/list.py
|
||||
@@ -45,7 +45,7 @@ def _list(filesystem: FileSystem, recursive: bool) -> str: # pylint: disable=W0
|
||||
if not recursive:
|
||||
options.append("-d 1")
|
||||
|
||||
- return f"/usr/bin/env - zfs list {' '.join(options)} '{filesystem.name}'"
|
||||
+ return f"/usr/bin/env zfs list {' '.join(options)} '{filesystem.name}'"
|
||||
|
||||
|
||||
def _snapshots(zfs_list_output: bytes) -> List[Snapshot]:
|
||||
diff --git a/zfs/replicate/snapshot/send.py b/zfs/replicate/snapshot/send.py
|
||||
index 9ebe9f2..20e4c08 100644
|
||||
--- a/zfs/replicate/snapshot/send.py
|
||||
+++ b/zfs/replicate/snapshot/send.py
|
||||
@@ -62,9 +62,9 @@ def _send(
|
||||
if previous is not None:
|
||||
options.append(f"-i '{previous.filesystem.name}@{previous.name}'")
|
||||
|
||||
- return f"/usr/bin/env - zfs send {' '.join(options)} '{current.filesystem.name}@{current.name}'"
|
||||
+ return f"/usr/bin/env zfs send {' '.join(options)} '{current.filesystem.name}@{current.name}'"
|
||||
|
||||
|
||||
def _receive(remote: FileSystem, current: Snapshot, decompress_command: str) -> str:
|
||||
destination = filesystem.remote_dataset(remote, current.filesystem)
|
||||
- return f"{decompress_command}/usr/bin/env - zfs receive -F -d '{destination.name}'"
|
||||
+ return f"{decompress_command}/usr/bin/env zfs receive -F -d '{destination.name}'"
|
||||
--
|
||||
2.51.2
|
||||
7
overlays/zfs-replicate.nix
Normal file
7
overlays/zfs-replicate.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
final: prev: {
|
||||
zfs-replicate = prev.zfs-replicate.overrideAttrs (oldAttrs: {
|
||||
patches = (oldAttrs.patches or []) ++ [
|
||||
./zfs-replicate-env-fix.patch
|
||||
];
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue