From dfb347eb3aa4982cdad1ce8006104fa49a7b73fa Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 22 Sep 2024 18:52:06 +0200 Subject: [PATCH] Ask for confirmation when creating win usb --- winiso/deploy.fish | 7 +++++++ winiso/lib/confirm.fish | 4 ++++ 2 files changed, 11 insertions(+) create mode 100755 winiso/lib/confirm.fish diff --git a/winiso/deploy.fish b/winiso/deploy.fish index 8f4c714e..997cce3b 100755 --- a/winiso/deploy.fish +++ b/winiso/deploy.fish @@ -4,6 +4,7 @@ begin set -l $varName set -l dir (status dirname) source "$dir/lib/choose-disk.fish" + source "$dir/lib/confirm.fish" set $varName (bash -c ". $(string escape $dir)/.env; echo \$$varName" 2> /dev/null) [ ! -z "$$varName" ] @@ -251,6 +252,12 @@ begin chooseDisk WIN_DISK end + echo "Proceeding will cause the disk `$WIN_DISK` to be wiped." + + if ! confirm "Are you sure you want to continue?" "n" + exit 1 + end + sudo shred -vfzn 0 -s 512 "$WIN_DISK" begin diff --git a/winiso/lib/confirm.fish b/winiso/lib/confirm.fish new file mode 100755 index 00000000..f83f5de4 --- /dev/null +++ b/winiso/lib/confirm.fish @@ -0,0 +1,4 @@ +#!/bin/env fish +function confirm -a message default + fish "$(status dirname)/../../lib/modules/partition/confirm.fish" $argv +end