diff --git a/wipe.pl b/wipe.pl index 6166f97..8d4dbea 100755 --- a/wipe.pl +++ b/wipe.pl @@ -48,12 +48,12 @@ sub uniq { # To get the list of devices we will be cleaning sub getdisks { - my $devices = `find /dev/sd*[a-z]`; + my $devices = `find /dev -name "sd*[a-z]"`; my %listhash = (); foreach(split("\n",$devices)) { my $devicepath = $_; my $serial = `udevadm info --query=all --name=$_ | grep SERIAL_SHORT | sed -e 's/^.*=//'`; - my $model = `udevadm info --query=all --name=$_ | grep ID_MODEL | sed -e 's/^.*=//'`; + my $model = `udevadm info --query=all --name=$_ | grep "ID_MODEL=" | sed -e 's/^.*=//'`; chomp( $serial ); chomp( $model ); if ( $serial && $model ) { @@ -135,12 +135,13 @@ while () { my %disks = getdisks(); my $batchcount = keys %disks; print "About to wipe ".$batchcount." drives with the following serial numbers:\n"; - foreach my $diskid (sort {$a cmp $b} keys %disks) { + foreach my $diskid (sort {$disks{$a}{"serial"} cmp $disks{$b}{"serial"}} keys %disks) { print $disks{$diskid}{"serial"}."\n"; } anykey("Hit any key to continue...\n"); foreach my $diskid (sort {$a cmp $b}keys %disks) { - print "\e[0;0H\e[2J"; # move cursor to 0,0 and then clear all text below. +# Disabling this because it just dosen't look good. +# print "\e[0;0H\e[2J"; # move cursor to 0,0 and then clear all text below. print "="x33; printf '[ %-10s ]', $diskid; print "="x33; @@ -163,6 +164,6 @@ while () { print join("\n",sort {$a cmp $b} uniq(@failed)); @failed = (); @good = (); - print $color{"green"}."-"x34.$color{"red"}."\nWipe complete, insert more drives.\n".$color{"green"}."-"x34."\n"; + print $color{"green"}.("-"x34).$color{"red"}."\nWipe complete, insert more drives.\n".$color{"green"}.("-"x34).$color{"reset"}."\n"; anykey("Hit any key when ready to continue...\n"); }