Added full zeroing option (untested)

This commit is contained in:
bluesaxman 2019-10-31 11:10:12 -06:00
parent fd08e597a0
commit 9d4902aad1

13
wipe.pl
View File

@ -38,6 +38,8 @@ my %color = (
);
my $notreally = grep /--notreally/, @ARGV;
my $longrun = grep /--long/, @ARGV;
if (!$notreally && CONFIRMATION_PHRASE) {
say "$color{brightred}WARNING$color{reset}: This program will $color{brightred}COMPLETELY DESTROY ALL DATA ON ALL SYSTEM DRIVES$color{reset}";
print 'Please type "'.CONFIRMATION_PHRASE.qq(" if you are $color{brightred}CERTAIN$color{reset} you want to continue: );
@ -125,7 +127,6 @@ sub wipethemdrives {
$disksum2 = md5_base64($diskdata);
close($diskr);
}
# say "Disk Checksum: $disksum";
if ($disksum eq $clobsum) {
say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}";
print " Checking raid wipe...";
@ -141,6 +142,16 @@ sub wipethemdrives {
return 0;
}
# If long flag than zero whole disk and give a progress bar
if ($longrun) {
say "Zeroing $disks->{$diskid}{path}...";
open(my $longdiskw, ">:raw", $disks->{$diskid}{path}) or return warning("could not open $disks->{$diskid}{path}");
seek($longdiskw,0,2);
my $totalBytes = tell($longdiskw);
until (eof $longdiskw) {
print $longdiskw "\0";
printf(" %5.5s%%\r\r\r\r\r\r\r", sprintf("%.2f", (tell($longdiskw)/$totalBytes)) );
}
}
}
# to test a drive