mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
New version. NBD network block device fixes
Two enhancements/bug fixes: 1. inxi did not have support for network block devices /dev/nbd0 type syntax in disks. 2. this caused a slight failure in lsblk output, so I switched to using lsblk -P to force paired key values, which are then put into an array of hashes. These both appeared on an ARM server system, but surprisingly, there were no ARM specific issues at all on that system. Both issues/enhancements tested and working fine.
This commit is contained in:
parent
2b9562c46d
commit
174078bcce
42
inxi
42
inxi
|
@ -31,7 +31,7 @@ use POSIX qw(uname strftime ttyname);
|
|||
|
||||
## INXI INFO ##
|
||||
my $self_name='inxi';
|
||||
my $self_version='3.0.02';
|
||||
my $self_version='3.0.03';
|
||||
my $self_date='2018-04-12';
|
||||
my $self_patch='00';
|
||||
## END INXI INFO ##
|
||||
|
@ -7169,7 +7169,7 @@ sub proc_data {
|
|||
foreach (@proc_partitions){
|
||||
next if (/^\s*$/);
|
||||
my @row = split /\s+/, $_;
|
||||
if ( $row[-1] =~ /^([hsv]d[a-z]+|(ada|mmcblk|nvme[0-9]+n)[0-9]+)$/) {
|
||||
if ( $row[-1] =~ /^([hsv]d[a-z]+|(ada|mmcblk|n[b]?d|nvme[0-9]+n)[0-9]+)$/) {
|
||||
$drive_size = $row[2];
|
||||
$b_hdx = 1 if $row[-1] =~ /^hd[a-z]/;
|
||||
@data = ({
|
||||
|
@ -7192,9 +7192,10 @@ sub proc_data {
|
|||
# $size += $row[2];
|
||||
# }
|
||||
# special case from this data: 8 0 156290904 sda
|
||||
# 43 0 48828124 nbd0
|
||||
# note: known starters: vm: 252/253/254; grsec: 202; nvme: 259
|
||||
if ( $row[0] =~ /^(3|8|22|33|202|252|253|254|259)$/ &&
|
||||
$row[-1] =~ /(nvme[0-9]+n[0-9]+|[hsv]d[a-z]+)$/ &&
|
||||
if ( $row[0] =~ /^(3|8|22|33|43|202|252|253|254|259)$/ &&
|
||||
$row[-1] =~ /(n[b]?d[0-9]+|nvme[0-9]+n[0-9]+|[hsv]d[a-z]+)$/ &&
|
||||
( $row[1] % 16 == 0 || $row[1] % 16 == 8 ) ) {
|
||||
$size += $row[2];
|
||||
}
|
||||
|
@ -9999,9 +10000,24 @@ sub get_bsd_label_uuid {
|
|||
sub set_lsblk {
|
||||
eval $start if $b_log;
|
||||
$b_lsblk = 1;
|
||||
my (@temp,@working);
|
||||
if (my $program = main::check_program('lsblk')){
|
||||
@lsblk = main::grabber("$program -r --output NAME,TYPE,RM,FSTYPE,SIZE 2>/dev/null");
|
||||
@working = main::grabber("$program -P --output NAME,TYPE,RM,FSTYPE,SIZE 2>/dev/null");
|
||||
foreach (@working){
|
||||
my ($name,$type,$rm,$fstype,$size) = ('','','','','');
|
||||
if (/NAME="([^"]*)"\s+TYPE="([^"]*)"\s+RM="([^"]*)"\s+FSTYPE="([^"]*)"\s+SIZE="([^"]*)"/){
|
||||
my @temp = ({
|
||||
'name' => $1,
|
||||
'type' => $2,
|
||||
'rm' => $3,
|
||||
'fs' => $4,
|
||||
'size' => $5
|
||||
});
|
||||
@lsblk = (@lsblk,@temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
# print Data::Dumper::Dumper \@lsblk;
|
||||
main::log_data('dump','@lsblk',\@lsblk) if $b_log;
|
||||
shift @lsblk if @lsblk; # get rid of row headers
|
||||
eval $end if $b_log;
|
||||
|
@ -10010,13 +10026,13 @@ sub check_lsblk {
|
|||
eval $start if $b_log;
|
||||
my ($name,$b_size) = @_;
|
||||
my (%part,@row);
|
||||
foreach (@lsblk){
|
||||
@row = split /\s+/, $_;
|
||||
next if ! $row[1];
|
||||
if ($name eq $row[0]){
|
||||
$part{'fs'} = $row[3];
|
||||
$part{'size'} = $row[-1] / 1024 if $b_size && $row[-1];
|
||||
$part{'rm'} = $row[2] if defined $row[2];
|
||||
foreach my $ref (@lsblk){
|
||||
my %row = %$ref;
|
||||
next if ! $row{'name'};
|
||||
if ($name eq $row{'name'}){
|
||||
$part{'fs'} = $row{'fs'};
|
||||
$part{'size'} = $row{'size'}/ 1024 if $b_size && $row{'size'};
|
||||
$part{'rm'} = $row{'rm'} if $row{'rm'};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
@ -15006,7 +15022,7 @@ sub get_tty_console_irc {
|
|||
sub get_tty_number {
|
||||
eval $start if $b_log;
|
||||
my $tty = POSIX::ttyname(1);
|
||||
#variants: /dev/pts/1 /dev/tty1 /dev/pts/5 /dev/ttyp2 /dev/pts/1
|
||||
#variants: /dev/pts/1 /dev/tty1 /dev/ttyp2 /dev/ttyra [hex number a]
|
||||
$tty =~ s/.*\/[^0-9]*//g if defined $tty;
|
||||
$tty = '' if ! defined $tty;
|
||||
log_data('data',"tty:$tty") if $b_log;
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
=====================================================================================
|
||||
Version: 3.0.03
|
||||
Patch Version: 00
|
||||
Script Date: 2018-04-12
|
||||
-----------------------------------
|
||||
Changes:
|
||||
-----------------------------------
|
||||
New version. NBD network block device fixes
|
||||
|
||||
Two enhancements/bug fixes:
|
||||
1. inxi did not have support for network block devices /dev/nbd0 type syntax in
|
||||
disks.
|
||||
2. this caused a slight failure in lsblk output, so I switched to using lsblk -P
|
||||
to force paired key values, which are then put into an array of hashes.
|
||||
|
||||
These both appeared on an ARM server system, but surprisingly, there were no ARM
|
||||
specific issues at all on that system.
|
||||
|
||||
Both issues/enhancements tested and working fine.
|
||||
|
||||
-----------------------------------
|
||||
-- Harald Hope - Thu, 12 Apr 2018 19:22:27 -0700
|
||||
|
||||
=====================================================================================
|
||||
Version: 3.0.02
|
||||
Patch Version: 00
|
||||
|
|
Loading…
Reference in a new issue