Fixed minor syntax and logic errors

This commit is contained in:
bluesaxman 2019-11-04 14:08:29 -07:00
parent 9fdfaea7fe
commit 4edd340135

10
wipe.pl
View File

@ -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}"; }