From 4edd34013549e17309ac947d4b63e64da2245987 Mon Sep 17 00:00:00 2001 From: bluesaxman Date: Mon, 4 Nov 2019 14:08:29 -0700 Subject: [PATCH] Fixed minor syntax and logic errors --- wipe.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wipe.pl b/wipe.pl index c2ad783..38d1e27 100755 --- a/wipe.pl +++ b/wipe.pl @@ -134,7 +134,6 @@ sub wipethemdrives { print " Checking raid wipe..."; if ($disksum2 eq $clobsum) { say +("."x$spacer)."Checksum $color{green}PASSED$color{reset}"; - return 1; } else { say +("."x$spacer)."Checksum $color{red}FAILED$color{reset}"; return 0; @@ -150,13 +149,14 @@ sub wipethemdrives { seek($longdiskw,0,2); my $totalBytes = tell($longdiskw); seek($longdiskw,0,0); - until (eof $longdiskw) { + for (0..$totalBytes) { print $longdiskw "\0"; - if ( !(tell($lingdiskw) % ($totoalBytes / 1000) ) { + if ( !(tell($longdiskw) % ($totalBytes / 1000)) ) { printf(" %5.5s%%\r\r\r\r\r\r\r", sprintf("%.2f", (tell($longdiskw)/$totalBytes)) ); - } + } } } + return 1; } # to test a drive @@ -165,7 +165,7 @@ sub smartcheck { my $diskid = shift; my $disks = shift; print "Checking overall-health self-assessment test result: ".(" "x19); - (my $smartassess = `smartctl /dev/sda -H | grep overall`) or (say "$!\ncould not check smart data, skipping" and return 1); + (my $smartassess = `smartctl $disks->{$diskid}{path} -H | grep overall`) or (say "\n$!\ncould not check smart data, skipping" and return 1); $disks->{$diskid}{selftest} = (split(": ", $smartassess))[1]; if ( "FAILED" eq $disks->{$diskid}{selftest} ) { say "$color{red}Failed$color{reset}"; return 0 } else { say "$color{green}Passed$color{reset}"; }