#!/bin/sh

./destroy-target

zfs create tank/target

cat "$1"
prev_snapshot=""
for test_snapshot in $(zfs list -H -t snapshot -o name tank/test)
do
    name="$(echo "$test_snapshot" | cut -d '@' -f 2)"
    echo "Processing snapshot: $name"
    #zfs diff "$prev_snapshot" "$test_snapshot"
    echo Running "$1" "$name" "$prev_snapshot"
    "$1" "$name" "$prev_snapshot"

    echo zfs snapshot -r "tank/target@$name"
    zfs snapshot -r "tank/target@$name"

    prev_snapshot="$name"
done

./display-usage