Add a script to resume a zfs send/recv.
This commit is contained in:
parent
477637ae62
commit
8b1e76d9d7
@ -17,6 +17,13 @@ let
|
||||
(old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
|
||||
});
|
||||
zfs_clone_resume =
|
||||
(pkgs.writeScriptBin "zfs_clone_resume" (builtins.readFile ./files/zfs_clone_resume.bash))
|
||||
.overrideAttrs
|
||||
(old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
|
||||
});
|
||||
in
|
||||
{
|
||||
@ -35,5 +42,6 @@ in
|
||||
environment.systemPackages = with pkgs; [
|
||||
zfs_clone_send
|
||||
zfs_clone_recv
|
||||
zfs_clone_resume
|
||||
];
|
||||
}
|
||||
|
17
nix/configuration/roles/zfs/files/zfs_clone_resume.bash
Normal file
17
nix/configuration/roles/zfs/files/zfs_clone_resume.bash
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Resume a zfs send.
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function main {
|
||||
local hst="$1"
|
||||
local dst="$2"
|
||||
local token
|
||||
token=$(zfs get -H -o value receive_resume_token "$dst")
|
||||
ssh "$hst" doas zfs send --verbose -t "$token" | doas zfs recv -s "$dst"
|
||||
|
||||
}
|
||||
|
||||
main "${@}"
|
Loading…
x
Reference in New Issue
Block a user