Skip to content

Commit

Permalink
Merge pull request #309 from mariux64/fix-mxraid_assemble-smartctl-call
Browse files Browse the repository at this point in the history
Fix mxraid assemble smartctl call
  • Loading branch information
thomas authored Feb 16, 2023
2 parents e2f3733 + 9cb66bb commit 0bdecd5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mxraid/mxraid_assemble
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import MxRaid::HostData;
import MxRaid::Utils;
import MxRaid::Color;

my $VERSION = '1.1';
my $VERSION = '1.2';

sub exec_usage {

Expand Down Expand Up @@ -712,7 +712,7 @@ exit;
my @ret;
my $num = scalar @$dev_list;
for (my $i=0; $i<$num; $i++) {
my ($dk) = $dev_list->[$i] =~ m|([^/]+)$|;
my ($dk) = $dev_list->[$i] =~ m|([^/]+)$|; # '/sys/block/sda' -> 'sda'

my $model = sys_fs_get_prop('/sys/block/'.$dk.'/device/model');
my $sizeb = sys_fs_get_prop('/sys/block/'.$dk.'/size') * 512;
Expand All @@ -735,7 +735,7 @@ exit;
$serial_number =~ s/^\s+//;
} else {
if ($self->{root_priv}) {
$serial_number = smartctl_info($dev_list->[$i], 'Serial_Number');
$serial_number = smartctl_info('/dev/'.$dk, 'Serial_Number');
} else {
warn "# You must be root to query '$dk'.\n" if $self->{verbose} >= 1;
}
Expand Down Expand Up @@ -801,6 +801,7 @@ exit;
if ($parse) {
my ($key, $val) = $_ =~ m/^([^:]+):\s*(.+)$/;
next unless defined $key and defined $val;
$key =~ s/\s+/_/g;
$smart_data{$key} = $val;
}
}
Expand Down

0 comments on commit 0bdecd5

Please sign in to comment.