Skip to content

Commit

Permalink
Add --hide-sn parameter (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
Napsty authored Apr 29, 2023
1 parent e352544 commit a40b073
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions check_smart.pl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';

use vars qw($opt_b $opt_d $opt_g $opt_debug $opt_h $opt_i $opt_e $opt_E $opt_r $opt_s $opt_v $opt_w $opt_q $opt_l $opt_skip_sa $opt_skip_temp);
use vars qw($opt_b $opt_d $opt_g $opt_debug $opt_h $opt_i $opt_e $opt_E $opt_r $opt_s $opt_v $opt_w $opt_q $opt_l $opt_skip_sa $opt_skip_temp $opt_hide_sn);
Getopt::Long::Configure('bundling');
GetOptions(
"debug" => \$opt_debug,
Expand All @@ -90,6 +90,7 @@
"l" => \$opt_l, "ssd-lifetime" => \$opt_l,
"skip-self-assessment" => \$opt_skip_sa,
"skip-temp-check" => \$opt_skip_temp,
"hide-sn" => \$opt_hide_sn,
);

if ($opt_v) {
Expand Down Expand Up @@ -356,8 +357,13 @@
}
if($line =~ /$line_serial_ata(.+)/){
warn "(debug) parsing line:\n$line\n\n" if $opt_debug;
$serial = $1;
$serial =~ s/^\s+|\s+$//g;
if($opt_hide_sn) {
$serial = "<HIDDEN>";
warn "(debug) Hiding serial number\n\n" if $opt_debug;
} else {
$serial = $1;
$serial =~ s/^\s+|\s+$//g;
}
warn "(debug) found serial number $serial\n\n" if $opt_debug;
}
if($line =~ /$line_serial_scsi(.+)/){
Expand Down

0 comments on commit a40b073

Please sign in to comment.