#!/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 "${@}"
