From 1ee9ad48627542ce1130bcfac03ef648b471b095 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Fri, 24 Nov 2023 15:33:24 +0100 Subject: [PATCH] Add a protection function against not disabling block cloning Signed-off-by: magic_rb --- home-manager/modules/bash/bashrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/home-manager/modules/bash/bashrc b/home-manager/modules/bash/bashrc index bd843bc..d10db76 100644 --- a/home-manager/modules/bash/bashrc +++ b/home-manager/modules/bash/bashrc @@ -133,3 +133,19 @@ function yaml2nix() nixfmt "${output_file}" } + +function zpool_warning() +{ + if ! ( echo "$@" | grep -v create ) ; then + if [[ "$ZFS_I_REMEMBERED_TO_DISABLE_BLOCK_CLONING" == "1" ]] ; then + echo "I trust you, carry on! But be careful to disable block cloning..." + env zpool "$@" + else + echo "Disable block cloning or you will have a very bad time!" + fi + else + env zpool "$@" + fi +} + +alias zpool="zpool_warning"