}
edit-in-commit () { $EDITOR $(git diff-tree --no-commit-id --name-only -r "$@"); }
edit-in-git-grep () { $EDITOR $(git grep --name-only --recursive "$@"); }
- zfs-mount () { for d in $(zfs list -rH -o name "$@"); do sudo zfs mount -l "$d"; done; }
+ zfs-mount () {
+ for d in $(zfs list -rH -o name "$@"); do
+ mountpoint /mnt/"$d" ||
+ sudo zfs mount -l "$d"
+ done
+ }
zfs-unmount () { sudo zfs unmount -u "$@"; }
+
+ # Raw replicating an encrypted ZFS dataset
+ # changes the encryptionroot to itself.
+ # Use zfs-fix-encryptionroot $new_encryptionroot
+ # to restore the inheritance.
+ # Note that it needs to decrypt all those datasets.
+ zfs-fix-encryptionroot () {
+ zfs load-key "$1"
+ for i in $(zfs list -rHo name "$1" | tail -n +2); do
+ echo >&2 "$i"
+ test "$(zfs get -Ho value encryptionroot $i)" = "$1" ||
+ zfs change-key -li "$i"
+ done
+ }
'';
profileExtra = ''
'';