Bugs!! Fixes! Spring cleaning!

Because these are either newly created, or newly discovered, bugs,
this release was pushed as early as possible to get them fixed asap.

BUGS:
1. Desktop: Lumina detection had a syntax error which made it not work.
This has been broken for a while.

2. Logical: if not root, and if LUKS / bcache detected, failed to load
proc_partitions, which generates error on --logical --admin since the
required components data was not loaded. This was an oversight.

3. The 3.3.02 ShellData refactor created a bug for console IRC, showed
shell, not irc client, name, and set default shell data which also
showed.

4. Console IRC tty: there was also an older bug that made -S, -G
not work consistently, and there were errors that had been missed
for many years in that logic. These should all be corrected, console
irc out of display, or in display as root, should now show tty info,
tty size in -G.

FIXES:
1. Memory: restored $bsd_type block on /proc/meminfo and force NetBSD
to use a corrected vmstat. This leaves that block of logic to correct
the NetBSD oddities in meminfo, but it may fix future isses that popup.

2. -Sxxx man page item incorrectly said XDG_VTNR was systemd/linux, it's
not, it's various things, GhostBSD has it, for example. See what you get
for believing what people say!

3. Logical: added in N/A for null maj-min in --logical report. While
bug 2 triggered those errors, there could be future cases where maj-min
are null, like BSD lvm data etc.

ENHANCEMENTS:
1. Going along with Fix 1, added '--force meminfo' in case you really want that.

2. Distro: System Base: Added TrueNAS detection.

3. Package Data: Added mport [MidnightBSD] type. That requires root to run
for some odd reason, so won't see the best output if not root.

CHANGES:
1. Moved logical to -v7 from -v8, it's stable enough now.

CODE CHANGES:
1. Moved get_tty_number and get_tty_console_irc to ShellData:tty_number
and ShellData::tty_console_irc.

ShellData::tty_number was being loaded several times, added
$loaded{'tty-number'} test, and made client{'tty-number'} to store value.

tty_console_irc changed to console_irc_tty, which is what it gets, removed
hacks and made it load once and store result in client hash.

2. Optimization: retested sub vs package::method and they run at exactly
the same time, give or take, so moving more stuff into packages to make
it easier to maintain.
This commit is contained in:
Harald Hope 2021-03-17 19:39:02 -07:00
parent c54ff52417
commit 3d4d1f533c
3 changed files with 224 additions and 91 deletions

232
inxi
View file

@ -36,14 +36,14 @@ use Getopt::Long qw(GetOptions);
Getopt::Long::Configure ('bundling', 'no_ignore_case',
'no_getopt_compat', 'no_auto_abbrev','pass_through');
use POSIX qw(uname strftime ttyname);
# use Benchmark qw(:all);
use Benchmark qw(:all);
# use Devel::Size qw(size total_size);
# use feature qw(say state); # 5.10 or newer Perl
## INXI INFO ##
my $self_name='inxi';
my $self_version='3.3.02';
my $self_date='2021-03-15';
my $self_version='3.3.03';
my $self_date='2021-03-17';
my $self_patch='00';
## END INXI INFO ##
@ -105,7 +105,7 @@ my $sensors_cpu_nu = 0;
my ($dl_ua,$weather_source,$weather_unit) = ('s-tools/' . $self_name . '-',100,'mi');
## Tools
my ($bt_tool,$display,$ftp_alt,$tty_session);
my ($bt_tool,$display,$ftp_alt);
my ($display_opt,$sudoas) = ('','');
## Output
@ -3642,7 +3642,7 @@ sub set_program_values {
'kwin_x11' => ['^kwin_x11',0,'0','kwin_x11',0,1,0,'',''],# no version
'larswm' => ['^larswm',2,'-v','larswm',0,1,1,'',''],
'liri' => ['^liri',0,'0','liri',0,1,0,'',''],
'lumina' => ['^\S',1,'--version','Lumina',0,1,1,'',''],
'lumina-desktop' => ['^\S',1,'--version','Lumina',0,1,1,'',''],
'lwm' => ['^lwm',0,'0','lwm',0,1,0,'',''], # no version
'lxpanel' => ['^lxpanel',2,'--version','LXDE',0,1,0,'',''],
# command: lxqt-panel
@ -4481,13 +4481,13 @@ sub get {
$show{'bluetooth-forced'} = 1;
$show{'cpu-flag'} = 1;
$show{'ip'} = 1;
$show{'logical'} = 1;
$show{'raid-forced'} = 1;
$extra = 3;
}
if ($arg >= 8 ){
$b_admin = 1;
$trigger{'downloader'} = 1;
$show{'logical'} = 1;
$show{'process'} = 1;
$show{'ps-cpu'} = 1;
$show{'ps-mem'} = 1;
@ -4733,8 +4733,8 @@ sub get {
'force:s' => sub {
my ($opt,$arg) = @_;
if ($arg){
my $wl = 'display|dmidecode|hddtemp|lsusb|man|no-dig|no-doas|no-html-wan|';
$wl .= 'no-sudo|usb-sys|vmstat|wmctrl';
my $wl = 'display|dmidecode|hddtemp|lsusb|man|meminfo|';
$wl .= 'no-dig|no-doas|no-html-wan|no-sudo|usb-sys|vmstat|wmctrl';
for (split(',',$arg)){
if ($_ =~ /\b($wl)\b/){
$force{lc($1)} = 1;
@ -5113,10 +5113,10 @@ sub show_options {
['2', '6', '', "Full $partition_string (-p),
unmounted $partition_string (-o), optical drive (-d), USB (-J),
full RAID; triggers -xx." ],
['2', '7', '', "Network IP data (-i), bluetooth and RAID forced;
triggers -xxx."],
['2', '8', '', "Everything available, including logical (-L),
repos (-r), processes (-tcm), PCI slots (--slots); triggers admin (-a)."],
['2', '7', '', "Network IP data (-i), bluetooth, logical (-L),
RAID forced; triggers -xxx."],
['2', '8', '', "Everything available, including repos (-r),
processes (-tcm), PCI slots (--slots); triggers admin (-a)."],
);
# if distro maintainers don't want the weather feature disable it
if ( $use{'weather'} ){
@ -5346,8 +5346,9 @@ sub show_options {
['1', '', '--dmidecode', "Force use of dmidecode data instead of /sys where relevant
(e.g. -M, -B)." ],
['1', '', '--downloader', "Force $self_name to use [curl|fetch|perl|wget] for downloads." ],
['1', '', '--force', "[dmidecode|hddtemp|lsusb|usb-sys|vmstat|wmctl]. Force use of item,
see --hddtemp, --dmidecode, --wm, --usb-tool, --usb-sys." ],
['1', '', '--force', "[dmidecode|hddtemp|lsusb|meminfo|usb-sys|vmstat|wmctl]. 1 or more
in comma separated list. Force use of item(s).
See --hddtemp, --dmidecode, --wm, --usb-tool, --usb-sys." ],
['1', '', '--hddtemp', "Force use of hddtemp for disk temps." ],
['1', '', '--host', "Turn on hostname for -S." ],
['1', '', '--html-wan', "Overrides configuration item NO_HTML_WAN (resets to default)." ],
@ -5535,7 +5536,7 @@ sub get_client_name {
if ($ppid && -e "/proc/$ppid/exe" ){
$client_name = lc(readlink "/proc/$ppid/exe");
$client_name =~ s/^.*\///;
if ($client_name =~ /^bash|dash|sh|python.*|perl.*$/){
if ($client_name =~ /^(bash|csh|dash|fish|sh|python.*|perl.*|zsh)$/){
$pppid = (main::grabber("ps -wwp $ppid -o ppid"))[1];
#my @temp = (main::grabber("ps -wwp $ppid -o ppid 2>/dev/null"))[1];
$pppid =~ s/^\s+|\s+$//g;
@ -5590,7 +5591,7 @@ sub get_client_version {
$client{'name-print'} = $app[3];
$client{'console-irc'} = $app[4];
}
if ($client{'name'} =~ /^bash|dash|sh$/ ){
if ($client{'name'} =~ /^(bash|csh|fish|dash|sh|zsh)$/ ){
$client{'name-print'} = 'shell wrapper';
$client{'console-irc'} = 1;
}
@ -12037,11 +12038,14 @@ sub tty_data(){
if ($size{'term-cols'}){
$tty = "$size{'term-cols'}x$size{'term-lines'}";
}
# this is broken
elsif ($b_irc && $client{'console-irc'}){
my $tty_working = main::get_tty_console_irc('tty');
if (my $program = main::check_program('stty')){
ShellData::console_irc_tty() if !$loaded{'con-irc-tty'};
my $tty_working = $client{'con-irc-tty'};
if ($tty_working ne '' && (my $program = main::check_program('stty'))){
my $tty_arg = ($bsd_type) ? '-f' : '-F';
$tty = (main::grabber("$program $tty_arg /dev/pts/$tty_working size 2>/dev/null"))[0];
$tty_working = "tty$tty_working" if main::is_numeric($tty_working);
$tty = (main::grabber("$program $tty_arg /dev/$tty_working size 2>/dev/null"))[0];
if ($tty){
my @temp = split(/\s+/, $tty);
$tty = "$temp[1]x$temp[0]";
@ -12434,6 +12438,7 @@ sub components_recursive_output {
$$rows[$$j]->{main::key($$num++,1,$l2,$id)} = $component->[0];
if ($extra > 1){
if ($b_admin){
$component->[1] ||= 'N/A';
$$rows[$$j]->{main::key($$num++,0,$l3,'maj-min')} = $component->[1];
$$rows[$$j]->{main::key($$num++,0,$l3,'mapped')} = $component->[3] if $component->[3];
$size = main::get_size($component->[2],'string','N/A');
@ -12451,6 +12456,7 @@ sub components_recursive_output {
sub general_data {
eval $start if $b_log;
my (@found,@general_data,%parent,$parent_fs);
main::set_proc_partitions() if !$loaded{'proc-partitions'};
main::set_mapper() if !$loaded{'mapper'};
foreach my $row (@lsblk){
# bcache doesn't have mapped name: !$mapper{$row->{'name'}} ||
@ -12509,14 +12515,14 @@ sub general_data {
sub lvm_data {
eval $start if $b_log;
$loaded{'lvm-data'} = 1;
main::set_proc_partitions() if !$loaded{'proc-partitions'};
main::set_mapper() if !$loaded{'mapper'};
my (@args,@data,%totals);
@args = qw(vg_name vg_fmt vg_size vg_free lv_name lv_layout lv_size
lv_kernel_major lv_kernel_minor segtype seg_count seg_start_pe seg_size_pe
stripes devices raid_mismatch_count raid_sync_action raid_write_behind
copy_percent);
my $num = 0;
main::set_proc_partitions() if !$loaded{'proc-partitions'};
main::set_mapper() if !$loaded{'mapper'};
if ($fake{'logical'}){
#my $file = "$ENV{'HOME'}/bin/scripts/inxi/data/lvm/lvs-test-1.txt";
#@data = main::reader($file,'strip');
@ -12594,7 +12600,6 @@ sub component_data {
my ($maj_min,$full_components) = @_;
push(@$full_components, component_recursive_data($maj_min));
}
sub component_recursive_data {
eval $start if $b_log;
my ($maj_min) = @_;
@ -17252,6 +17257,7 @@ sub get_repos_bsd {
my $freebsd_pkg = '/etc/pkg/FreeBSD.conf';
my $ghostbsd_pkg = '/etc/pkg/GhostBSD.conf';
my $hardenedbsd_pkg = '/etc/pkg/HardenedBSD.conf';
my $mports = '/usr/mports/Makefile';
my $netbsd = '/usr/pkg/etc/pkgin/repositories.conf';
my $openbsd = '/etc/pkg.conf';
my $openbsd2 = '/etc/installurl';
@ -17292,7 +17298,7 @@ sub get_repos_bsd {
}
#print "url:$url\n" if $url;
if ($data2[0] eq 'enabled'){
if ($url && $data2[1] eq 'yes'){
if ($url && $data2[1] =~ /^(1|true|yes)$/i){
push(@data3, "$url");
}
$url = '';
@ -17315,7 +17321,7 @@ sub get_repos_bsd {
}
}
}
elsif (-f $openbsd || -f $openbsd2) {
if (-f $openbsd || -f $openbsd2) {
if (-f $openbsd){
@data = repo_builder($openbsd,'openbsd','^installpath','\s*=\s*',1);
push(@rows,@data);
@ -17325,11 +17331,37 @@ sub get_repos_bsd {
push(@rows,@data);
}
}
elsif (-f $netbsd){
if (-f $netbsd){
# not an empty row, and not a row starting with #
@data = repo_builder($netbsd,'netbsd','^\s*[^#]+$');
push(@rows,@data);
}
# I don't think this is right, have to find out, for midnightbsd
# if (-f $mports){
# @data = main::reader($mports,'strip');
# main::writer("$debugger_dir/system-repo-data-mports.txt",\@data) if $debugger_dir;
# for (@data){
# if (!/^MASTER_SITE_INDEX/){
# next;
# }
# else {
# push(@data3,(split(/=\s*/,$_))[1]);
# }
# last if /^INDEX/;
# }
# if (!@data3){
# $key = repo_data('missing','mports');
# }
# else {
# url_cleaner(\@data3);
# $key = repo_data('active','mports');
# }
# push(@rows,
# {main::key($num++,1,1,$key) => $mports},
# [@data3],
# );
# @data3 = ();
# }
# BSDs do not default always to having repo files, so show correct error
# mesage in that case
if (!@rows){
@ -17374,6 +17406,8 @@ sub repo_data {
'freebsd-missing' => 'No FreeBSD update servers in',
'freebsd-pkg-active' => 'FreeBSD default pkg server',
'freebsd-pkg-missing' => 'No FreeBSD default pkg server in',
'mports-active' => 'mports servers',
'mports-missing' => 'No mports servers found',
'netbsd-active' => 'NetBSD pkg servers',
'netbsd-files-missing' => 'No NetBSD pkg server files found',
'netbsd-missing' => 'No NetBSD pkg servers in',
@ -19820,7 +19854,7 @@ sub get_kde_trinity_data {
# KDE_SESSION_VERSION is the integer version of the desktop
# NOTE: as of plasma 5, the tool: about-distro MAY be available, that will show
# actual desktop data, so once that's in debian/ubuntu, if it gets in, add that test
elsif ( $xdg_desktop eq 'kde' || $kde_session_version ){
elsif ($xdg_desktop eq 'kde' || $kde_session_version){
if ($kde_session_version && $kde_session_version <= 4){
@data = main::program_values("kded$kde_session_version");
if (@data){
@ -20404,7 +20438,7 @@ sub get_display_manager {
my (@data,@found,$path,$working,$b_run,$b_vrun,$b_vrunrc);
# ldm - LTSP display manager. Note that sddm does not appear to have a .pid
# extension in Arch note: to avoid positives with directories, test for -f
# explicitly, not -e. Guessing on cdm.pid
# explicitly, not -e. Guessing on cdm.pid. pcdm uses vt, PCDM-vt9.pid
my @dms = qw(cdm.pid entranced.pid gdm.pid gdm3.pid kdm.pid ldm.pid
lightdm.pid lxdm.pid mdm.pid nodm.pid pcdm.pid sddm.pid slim.lock
slim.pid tdm.pid udm.pid wdm.pid xdm.pid xenodm.pid);
@ -20495,12 +20529,23 @@ sub get_bsd_os {
@osr = main::reader($os_release) if -r $os_release;
if (@osr && $bsd_type =~ /($bsd_type_osr)/ && (grep {/($bsd_type_osr)/i} @osr)){
$distro = get_os_release();
$distro_id = lc($1);
}
}
if (!$distro){
my $bsd_type_version = 'truenas';
my ($version_file,$version_info) = ('/etc/version','');
$version_info = main::reader($version_file,'strip') if -r $version_file;
if ($version_info && $version_info =~ /($bsd_type_version)/i){
$distro = $version_info;
$distro_id = lc($1);
}
}
if (!$distro){
# seen a case without osx file, or was it permissions?
# this covers all the other bsds anyway, no problem.
$distro = "$uname[0] $uname[2]";
$distro_id = lc($uname[0]);
}
if ($distro &&
(-e '/etc/pkg/GhostBSD.conf' || -e '/usr/local/etc/pkg/repos/GhostBSD.conf') &&
@ -20767,14 +20812,17 @@ sub android_info {
sub system_base_bsd {
eval $start if $b_log;
# ghostbsd is handled in main bsd section
if (lc($uname[1]) eq 'nomadbsd' && $distro =~ /^freebsd/i){
if (lc($uname[1]) eq 'nomadbsd' && $distro_id eq 'freebsd'){
$system_base = $distro;
$distro = $uname[1];
}
if (-f '/etc/pkg/HardenedBSD.conf' && $distro =~ /^freebsd/i){
elsif (-f '/etc/pkg/HardenedBSD.conf' && $distro_id eq 'freebsd'){
$system_base = $distro;
$distro = 'HardenedBSD';
}
elsif ($distro_id =~ /^(truenas)$/){
$system_base = "$uname[0] $uname[2]";
}
eval $end if $b_log;
}
@ -21423,7 +21471,9 @@ sub get {
my ($memory);
# note: netbsd 8.0 has meminfo!
$loaded{'memory'} = 1;
if (!$force{'vmstat'} && (my $file = main::system_files('meminfo'))) {
# netbsd uses meminfo, but it uses it in a weird way
if (!$force{'vmstat'} && (!$bsd_type || ($force{'meminfo'} && $bsd_type)) &&
(my $file = main::system_files('meminfo'))) {
$memory = meminfo_data($type,$file);
}
else {
@ -21748,6 +21798,7 @@ sub package_counts {
['guix-sys','guix','p','package -p "/run/current-system/profile" -I',1,0,''],
['guix-usr','guix','p','package -I',1,0,''],
['kiss','kiss','p','list',1,0,''],
['mport','mport','p','list',1,0,''],
['nix-sys','nix-store','p','-qR /run/current-system/sw',1,1,'-'],
['nix-usr','nix-store','p','-qR ~/.nix-profile',1,1,'-'],
['nix-default','nix-store','p','-qR /nix/var/nix/profiles/default',1,2,'-'],
@ -21802,7 +21853,7 @@ sub package_counts {
}
}
# print Data::Dumper::Dumper \%counts;
main::log_data('dump','Packaage managers: %counts',\%counts) if $b_log;
main::log_data('dump','Package managers: %counts',\%counts) if $b_log;
eval $end if $b_log;
}
sub appimage_counts {
@ -22343,52 +22394,55 @@ sub ssh_status {
eval $end if $b_log;
return $b_ssh;
}
}
sub get_tty_console_irc {
# If IRC: called if root for -S, -G, or if not in display for user.
sub console_irc_tty {
eval $start if $b_log;
my ($type) = @_;
return $tty_session if defined $tty_session;
if ( $type eq 'vtrn' && defined $ENV{'XDG_VTNR'} ){
$tty_session = $ENV{'XDG_VTNR'};
$loaded{'con-irc-tty'} = 1;
# not set for root in or out of display
if (defined $ENV{'XDG_VTNR'} ){
$client{'con-irc-tty'} = $ENV{'XDG_VTNR'};
}
else {
$tty_session = awk(\@ps_aux,".*$ppid.*$client{'name'}",7,'\s+');
$tty_session =~ s/^[^[0-9]+// if $tty_session;
# ppid won't work with name, so this is assuming there's only one client running
# if in display, -G returns vt size, not screen dimensions in rowsxcols.
$client{'con-irc-tty'} = main::awk(\@ps_aux,'.*\b' . $client{'name'} . '\b.*',7,'\s+');
$client{'con-irc-tty'} =~ s/^(tty|\?)// if defined $client{'con-irc-tty'};
}
$tty_session = '' if ! defined $tty_session;
log_data('data',"conole-irc-tty:$tty_session") if $b_log;
$client{'con-irc-tty'} = '' if !defined $client{'con-irc-tty'};
main::log_data('data',"console-irc-tty:$client{'con-irc-tty'}") if $b_log;
eval $end if $b_log;
return $tty_session;
}
sub get_tty_number {
sub tty_number {
eval $start if $b_log;
my ($tty);
$loaded{'tty-number'} = 1;
# note: ttyname returns undefined if pinxi is > redirected output
# variants: /dev/pts/1 /dev/tty1 /dev/ttyp2 /dev/ttyra [hex number a]
$tty = POSIX::ttyname(1);
$client{'tty-number'} = POSIX::ttyname(1);
# but tty direct works fine in that case
if (!defined $tty && (my $program = check_program('tty'))){
chomp($tty = qx($program 2>/dev/null));
if (!defined $client{'tty-number'} && (my $program = main::check_program('tty'))){
chomp($client{'tty-number'} = qx($program 2>/dev/null));
if (defined $client{'tty-number'} && $client{'tty-number'} =~ /^not/){
undef $client{'tty-number'};
}
}
if (defined $tty){
$tty =~ s/^\/dev\/(tty)?//;
if (defined $client{'tty-number'}){
$client{'tty-number'} =~ s/^\/dev\/(tty)?//;
}
else {
$tty = '';
$client{'tty-number'} = '';
}
# systemd only item, usually same as tty in console, not defined
# for root or non systemd systems.
if (defined $ENV{'XDG_VTNR'} && $tty ne '' && $ENV{'XDG_VTNR'} ne $tty){
$tty = "$tty (vt $ENV{'XDG_VTNR'})";
if (defined $ENV{'XDG_VTNR'} && $client{'tty-number'} ne '' &&
$ENV{'XDG_VTNR'} ne $client{'tty-number'}){
$client{'tty-number'} = "$client{'tty-number'} (vt $ENV{'XDG_VTNR'})";
}
elsif ($tty eq '' && defined $ENV{'XDG_VTNR'}) {
$tty = $ENV{'XDG_VTNR'};
elsif ($client{'tty-number'} eq '' && defined $ENV{'XDG_VTNR'}) {
$client{'tty-number'} = $ENV{'XDG_VTNR'};
}
log_data('data',"tty:$tty") if $b_log;
main::log_data('data',"tty:$client{'tty-number'}") if $b_log;
eval $end if $b_log;
return $tty;
}
}
sub get_uptime {
@ -23509,7 +23563,7 @@ sub set_lsblk {
}
}
}
#print Data::Dumper::Dumper \@lsblk;
print Data::Dumper::Dumper \@lsblk if $dbg[32];
main::log_data('dump','@lsblk',\@lsblk) if $b_log;
eval $end if $b_log;
}
@ -24704,12 +24758,6 @@ sub generate_short_data {
eval $start if $b_log;
my $num = 0;
my $kernel_os = ($bsd_type) ? 'OS' : 'Kernel';
ShellData::set() if !$loaded{'shell-data'} && $ppid;
my $client = $client{'name-print'};
my $client_shell = ($b_irc) ? 'Client' : 'Shell';
if ($client{'version'}){
$client .= ' ' . $client{'version'};
}
my ($cpu_string,$speed,$speed_key,$type) = ('','','speed','');
my $memory = MemoryData::get('string');
my @cpu = CpuData::get('short');
@ -24767,8 +24815,16 @@ sub generate_short_data {
$disk_string = "$used/$size";
}
}
#print join('; ', @cpu), " sleep: $cpu_sleep\n";
$memory ||= 'N/A';
#print join('; ', @cpu), " sleep: $cpu_sleep\n";
if (!$loaded{'shell-data'} && $ppid && (!$b_irc || !$client{'name-print'})){
ShellData::set();
}
my $client = $client{'name-print'};
my $client_shell = ($b_irc) ? 'Client' : 'Shell';
if ($client{'version'}){
$client .= ' ' . $client{'version'};
}
my @data = ({
main::key($num++,0,0,'CPU') => $cpu_string,
main::key($num++,0,0,$speed_key) => $speed,
@ -24809,9 +24865,6 @@ sub generate_info_data {
$b_gcc = 1;
}
$gcc ||= 'N/A';
ShellData::set() if !$loaded{'shell-data'} && $ppid;
my $client_shell = ($b_irc) ? 'Client' : 'Shell';
my $client = $client{'name-print'};
my %data = (
$data_name => [{
main::key($num++,0,1,'Processes') => scalar @ps_aux,
@ -24895,6 +24948,11 @@ sub generate_info_data {
$data{$data_name}->[$index]{$_} = $packages{$_};
}
}
if (!$loaded{'shell-data'} && $ppid && (!$b_irc || !$client{'name-print'})){
ShellData::set();
}
my $client_shell = ($b_irc) ? 'Client' : 'Shell';
my $client = $client{'name-print'};
if (!$b_irc && $extra > 1){
# some bsds don't support -f option to get PPPID
# note: root/su - does not have $DISPLAY usually
@ -24902,31 +24960,32 @@ sub generate_info_data {
$parent = ShellData::shell_launcher();
}
else {
$parent = get_tty_number();
$parent = "tty $parent" if $parent ne '';
ShellData::tty_number() if !$loaded{'tty-number'};
$parent = "tty $client{'tty-number'}" if $client{'tty-number'} ne '';
}
# can be tty 0 so test for defined
$running_in = $parent if $parent;
if ($extra > 2 && $running_in && ShellData::ssh_status() ){
$running_in .= ' (SSH)';
}
}
if ($extra > 2 && $client{'su-start'}){
$client .= " ($client{'su-start'})";
if ($extra > 2 && $client{'su-start'}){
$client .= " ($client{'su-start'})";
}
}
$data{$data_name}->[$index]{main::key($num++,1,1,$client_shell)} = $client;
if ($extra > 0 && $client{'version'}){
$data{$data_name}->[$index]{main::key($num++,0,2,'v')} = $client{'version'};
}
if ($extra > 2 && $client{'default-shell'}){
$data{$data_name}->[$index]{main::key($num++,1,2,'default')} = $client{'default-shell'};
$data{$data_name}->[$index]{main::key($num++,0,3,'v')} = $client{'default-shell-v'} if $client{'default-shell-v'};
if (!$b_irc){
if ($extra > 2 && $client{'default-shell'}){
$data{$data_name}->[$index]{main::key($num++,1,2,'default')} = $client{'default-shell'};
$data{$data_name}->[$index]{main::key($num++,0,3,'v')} = $client{'default-shell-v'} if $client{'default-shell-v'};
}
if ($running_in){
$data{$data_name}->[$index]{main::key($num++,0,2,'running-in')} = $running_in;
}
}
if ($running_in){
$data{$data_name}->[$index]{main::key($num++,0,2,'running-in')} = $running_in;
}
$data{$data_name}->[$index]{main::key($num++,0,1,$self_name)} = &get_self_version();
$data{$data_name}->[$index]{main::key($num++,0,1,$self_name)} = get_self_version();
eval $end if $b_log;
return %data;
}
@ -24938,7 +24997,6 @@ sub generate_system_data {
my $data_name = main::key($prefix++,1,0,'System');
my ($desktop,$desktop_info,$desktop_key,$dm_key,$toolkit,$wm) = ('','','Desktop','dm','','');
my (@desktop_data,$desktop_version);
my %data = (
$data_name => [{}],
);
@ -24992,13 +25050,15 @@ sub generate_system_data {
}
}
if (!$b_display || (!$desktop && $b_root)) {
my $tty = get_tty_number();
ShellData::tty_number() if !$loaded{'tty-number'};
my $tty = $client{'tty-number'};
if (!$desktop){
$desktop_info = '';
}
# it is defined, as ''
if ($tty eq '' && $client{'console-irc'}){
$tty = get_tty_console_irc('vtnr');
ShellData::console_irc_tty() if !$loaded{'con-irc-tty'};
$tty = $client{'con-irc-tty'};
}
$desktop = "tty $tty" if $tty ne '';
$desktop_key = 'Console';
@ -25028,7 +25088,7 @@ sub generate_system_data {
}
}
#if ($extra > 2 && $desktop_key ne 'Console'){
# my $tty = get_tty_number();
# my $tty = ShellData::tty_number() if !$loaded{'tty-number'};
# $data{$data_name}->[$index]{main::key($num++,0,1,'vc')} = $tty if $tty ne '';
#}
my $distro_key = ($bsd_type) ? 'OS': 'Distro';

11
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2021\-03\-15" inxi "inxi manual"
.TH INXI 1 "2021\-03\-17" inxi "inxi manual"
.SH NAME
inxi \- Command line system information script for console and IRC
@ -717,11 +717,11 @@ USB (\fB\-J\fR); triggers \fB\-xx\fR extra data option.
.TP
.B \-v 7
\- Adds network IP data (\fB\-i\fR), forced bluetooth (\fB\-E\fR),
RAID (\fB\-R\fR); triggers \fB\-xxx\fR
Logical (\fB\-L\fR), RAID (\fB\-R\fR); triggers \fB\-xxx\fR
.TP
.B \-v 8
\- All system data available. Adds Logical (\fB\-L\fR), Repos (\fB\-r\fR),
\- All system data available. Adds Repos (\fB\-r\fR),
PCI slots (\fB\-\-slots\fR), processes (\fB\-tcm\fR), admin (\fB\-\-admin\fR).
Useful for testing output and to see what data you can get from your system.
@ -1316,8 +1316,9 @@ lxpanel, xfce4\-panel, lxqt\-panel, tint2, cairo-dock, trayer, and many others.
\- Adds (if present), display manager (\fBdm\fR) version number.
\- Adds (if Linux, systemd, and in display), virtual terminal (\fBvt\fR) number.
These are the same as \fBctrl+alt+F[x]\fR numbers usually.
\- Adds (if available, and in display), virtual terminal (\fBvt\fR) number.
These are the same as \fBctrl+alt+F[x]\fR numbers usually. Some systems
have this, some don't, it varies.
.TP
.B \-xxx \-w\fR,\fB \-W\fR

View file

@ -1,3 +1,75 @@
=====================================================================================
Version: 3.3.03
Patch: 00
Date: 2021-03-17
-----------------------------------
Changes:
-----------------------------------
Bugs!! Fixes! Spring cleaning!
Because these are either newly created, or newly discovered, bugs,
this release was pushed as early as possible to get them fixed asap.
BUGS:
1. Desktop: Lumina detection had a syntax error which made it not work.
This has been broken for a while.
2. Logical: if not root, and if LUKS / bcache detected, failed to load
proc_partitions, which generates error on --logical --admin since the
required components data was not loaded. This was an oversight.
3. The 3.3.02 ShellData refactor created a bug for console IRC, showed
shell, not irc client, name, and set default shell data which also
showed.
4. Console IRC tty: there was also an older bug that made -S, -G
not work consistently, and there were errors that had been missed
for many years in that logic. These should all be corrected, console
irc out of display, or in display as root, should now show tty info,
tty size in -G.
FIXES:
1. Memory: restored $bsd_type block on /proc/meminfo and force NetBSD
to use a corrected vmstat. This leaves that block of logic to correct
the NetBSD oddities in meminfo, but it may fix future isses that popup.
2. -Sxxx man page item incorrectly said XDG_VTNR was systemd/linux, it's
not, it's various things, GhostBSD has it, for example. See what you get
for believing what people say!
3. Logical: added in N/A for null maj-min in --logical report. While
bug 2 triggered those errors, there could be future cases where maj-min
are null, like BSD lvm data etc.
ENHANCEMENTS:
1. Going along with Fix 1, added '--force meminfo' in case you really want that.
2. Distro: System Base: Added TrueNAS detection.
3. Package Data: Added mport [MidnightBSD] type. That requires root to run
for some odd reason, so won't see the best output if not root.
CHANGES:
1. Moved logical to -v7 from -v8, it's stable enough now.
CODE CHANGES:
1. Moved get_tty_number and get_tty_console_irc to ShellData:tty_number
and ShellData::tty_console_irc.
ShellData::tty_number was being loaded several times, added
$loaded{'tty-number'} test, and made client{'tty-number'} to store value.
tty_console_irc changed to console_irc_tty, which is what it gets, removed
hacks and made it load once and store result in client hash.
2. Optimization: retested sub vs package::method and they run at exactly
the same time, give or take, so moving more stuff into packages to make
it easier to maintain.
-----------------------------------
-- Harald Hope - Wed, 17 Mar 2021 19:36:39 -0700
=====================================================================================
Version: 3.3.02
Patch: 00