Ask for confirmation when creating win usb

This commit is contained in:
Manuel Thalmann 2024-09-22 18:52:06 +02:00
parent 33758298cf
commit dfb347eb3a
2 changed files with 11 additions and 0 deletions

View file

@ -4,6 +4,7 @@ begin
set -l $varName set -l $varName
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/lib/choose-disk.fish" source "$dir/lib/choose-disk.fish"
source "$dir/lib/confirm.fish"
set $varName (bash -c ". $(string escape $dir)/.env; echo \$$varName" 2> /dev/null) set $varName (bash -c ". $(string escape $dir)/.env; echo \$$varName" 2> /dev/null)
[ ! -z "$$varName" ] [ ! -z "$$varName" ]
@ -251,6 +252,12 @@ begin
chooseDisk WIN_DISK chooseDisk WIN_DISK
end 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" sudo shred -vfzn 0 -s 512 "$WIN_DISK"
begin begin

4
winiso/lib/confirm.fish Executable file
View file

@ -0,0 +1,4 @@
#!/bin/env fish
function confirm -a message default
fish "$(status dirname)/../../lib/modules/partition/confirm.fish" $argv
end