From b3c72ae289b0247d4983c30a48bd688b2142ba99 Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Tue, 30 Apr 2019 17:56:10 -0700 Subject: [PATCH] New version, new man, new feature!! Bug fixes! Bugs: 1. issue #182 - in freebsd, there was an oversight in the pciconf parser, it was using unfiltered strings as regex pattern, and of course, a string flipped an error. Fix was to add the regex cleaner to the string before it's used in test. 2. NOTE: issue #182 had a second bug, but the issue poster didn't follow up with data or output so it couldn't be fixed. This was related to a syntax change in usbdevs -v output in FreeBSD. Such changes are too common, but it might also simply be a variant I have not seen or handled, but so far no data, so can't fix. Don't blame me if you get this bug, but do post requested debugger data if you want it fixed! Fixes: 1. Updated man for weather, explained more clearly how to use country codes for weather output. More clarifying in general about weather location, and weather restrictions. Enhancements: 1. Added avx/avx2 to default flag list in -C short form. Thanks damentz from liquorix for clarifying why that was a good idea. Note the initial issue came up in a Debian issue report, not here. People!! please post issues here, and don't bug maintainers with feature requests! Maintainers aren't in a position to add a feature, so you should go straight to the source. 1.a. Created in inxi-perl/docs new doc file: cpu-flags.txt, which explains all the flags, and also covers the short form flags and explains why they are used. 2. To resolve another issue, I made a new documentation file: inxi-perl/docs/inxi-custom-recommends.txt This is instructions for maintainers of distros who do not use rpm/apt/pacman but still want the --recommends feature to output their package pool package names for missing packages. I decided to not allow more than the default 3 package managers because no matter what people say, if I allow in more, the maintainer will vanish or lose interest, and I'll be stuck having to maintain their package lists forever. Also, it's silly to even include that package list for any distro that does not use rpm/apt/pacman, since the list is just wasted lines. Instructions in doc file show what to change, and how, and has an example to make it clear. Odds of this actually being used? Not high, lol, but that's fine, if people want it done, they can do it, if not, nothing bad happens, it just won't show any suggested install package, no big deal. 3. Using the new disk vendor method, added even more disk vendors. Thanks linux litet hardware database!! 4. EXCITING!! A new --admin/-a option, suggested by a user on techpatterns.com/forums/ Now -S or -b or -F with -a option for GNU/Linux shows the kernel boot parameters, from /proc/cmdline. Didn't find anything comparable for BSDs, if you can tell me where to look, I'll add it for those too, but wasn't anywhere I looked. Do the BSDs even use that method? Don't know, but the logic is there, waiting to be used if someone shows me how to get it cleanly. The 'parameters:' item shows in the main 'System:' -S output, and will just show the entire kernel parameters used to boot. This could be very helpful to distros who often have to determine if for example graphics blacklists are correctly applied for non free drivers, like nomodeset etc, or if the opposite is present. For forum/distro support, they just have to ask for: inxi -ba and they will see t the relevant graphics info, for instance, or -SGaxxx, or -Faxxx, whatever is used to trigger in this case the graphics and system lines. 5. Updated man/help for 4 as well, now explains what they will see with --admin/ -a options and -S. Good user suggestion, I wish all new features were this easy, heh. --- inxi | 91 ++++++++++++++++++++++++++++++++++++++++---------- inxi.1 | 15 +++++++-- inxi.changelog | 78 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 19 deletions(-) diff --git a/inxi b/inxi index d1fe25b..ee9f01a 100755 --- a/inxi +++ b/inxi @@ -31,8 +31,8 @@ use POSIX qw(uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.0.33'; -my $self_date='2019-03-29'; +my $self_version='3.0.34'; +my $self_date='2019-04-30'; my $self_patch='00'; ## END INXI INFO ## @@ -549,6 +549,7 @@ sub system_files { 'asound-cards' => '/proc/asound/cards', 'asound-modules' => '/proc/asound/modules', 'asound-version' => '/proc/asound/version', + 'cmdline' => '/proc/cmdline', 'cpuinfo' => '/proc/cpuinfo', 'dmesg-boot' => '/var/run/dmesg.boot', 'lsb-release' => '/etc/lsb-release', @@ -1786,6 +1787,7 @@ sub system_files { copy_files(\@files,'system-distro'); @files = ( '/proc/1/comm', + '/proc/cmdline', '/proc/cpuinfo', '/proc/meminfo', '/proc/modules', @@ -2437,7 +2439,7 @@ sub run { my (@data,@rows); my $line = make_line(); my $pm = get_pm(); - @data = basic_data($line); + @data = basic_data($line,$pm); push @rows,@data; if (!$bsd_type){ @data = check_items('required system directories',$line,$pm); @@ -2467,9 +2469,10 @@ sub run { } sub basic_data { - my ($line) = @_; + my ($line,$pm_local) = @_; my (@data,@rows); my $client = $client{'name-print'}; + $pm_local ||= 'N/A'; $client .= ' ' . $client{'version'} if $client{'version'}; my $default_shell = 'N/A'; if ($ENV{'SHELL'}){ @@ -2491,6 +2494,7 @@ sub basic_data { ['0', '', '', "Current shell: " . $client ], ['0', '', '', "Default shell: " . $default_shell ], ['0', '', '', "sh links to: $sh_real" ], + ['0', '', '', "Package manager: $pm_local" ], ); return @rows; } @@ -2612,7 +2616,10 @@ sub check_items { } else { $result = 'Missing'; - $install = " ~ Install package: $info{$pm}" if (($b_program || $b_module) && $pm); + if (($b_program || $b_module) && $pm){ + $info{$pm} ||= 'N/A'; + $install = " ~ Install package: $info{$pm}"; + } push @missing, "$_$install"; } $row = make_row($_,$about,$result); @@ -2640,7 +2647,7 @@ sub check_items { sub item_data { my ($type) = @_; my %data = ( - # directory data + # Directory Data '/sys/class/dmi/id' => ({ 'info' => '-M system, motherboard, bios', }), @@ -2665,7 +2672,7 @@ sub item_data { '/sys' => ({ 'info' => '', }), - # file data + # File Data '/etc/lsb-release' => ({ 'info' => '-S distro version data (older version)', }), @@ -2702,8 +2709,9 @@ sub item_data { '/var/run/dmesg.boot' => ({ 'info' => '-D,-d disk data', }), - # system tools - # apt-dpkg,apt-get; pm-arch,pacman; rpm-redhat,suse + ## START PACKAGE MANAGER BLOCK ## + # Note: see inxi-perl branch for details: docs/recommends-package-manager.txt + # System Tools 'blockdev' => ({ 'info' => '--admin -p/-P (filesystem blocksize)', 'info-bsd' => '', @@ -2921,7 +2929,7 @@ sub item_data { 'pacman' => 'wget', 'rpm' => 'wget', }), - # display tools + # Display Tools 'glxinfo' => ({ 'info' => '-G glx info', 'info-bsd' => '-G glx info', @@ -2957,7 +2965,7 @@ sub item_data { 'pacman' => 'xrandr', 'rpm' => 'x11-server-utils', }), - # Perl modules + # Perl Modules 'Cpanel::JSON::XS' => ({ 'info' => '--output json - required for export.', 'info-bsd' => '--output json - required for export.', @@ -3007,6 +3015,7 @@ sub item_data { 'pacman' => 'perl-xml-dumper', 'rpm' => 'perl-XML-Dumper', }), + ## END PACKAGE MANAGER BLOCK ## ); my $ref = $data{$type}; my %values = %$ref; @@ -3014,6 +3023,7 @@ sub item_data { } sub get_pm { my ($pm) = (''); + # support maintainers of other pm types using custom lists if (main::check_program('dpkg')){ $pm = 'apt'; } @@ -4451,6 +4461,7 @@ sub show_options { ['2', '-p,-P', '', "If available: raw size of partition, percent available for user, block size of file system (root required); for swap, shows swapiness and vfs cache pressure, and if values are default or not." ], + ['2', '-S', '', "If available: kernel boot parameters." ], ['1', '-A', '--audio', "Audio/sound card(s), driver, sound server." ], ['1', '-b', '--basic', "Basic output, short form. Same as $self_name^-v^2." ], ['1', '-B', '--battery', "System battery info, including charge and condition, plus @@ -6662,8 +6673,8 @@ sub create_output_full { $flag_key = ($b_arm || $bsd_type) ? 'features': 'flags'; my $flag = 'N/A'; if (@flags){ - # failure to read dmesg.boot: dmesg.boot permissions - @flags = grep {/^(dmesg.boot|lm|nx|pae|permissions|pni|svm|vmx|(sss|ss)e([2-9])?([a-z])?(_[0-9])?)$/} @flags; + # failure to read dmesg.boot: dmesg.boot permissions; then short -Cx list flags + @flags = grep {/^(dmesg.boot|permissions|avx[2-9]?|lm|nx|pae|pni|(sss|ss)e([2-9])?([a-z])?(_[0-9])?|svm|vmx)$/} @flags; @flags = map {s/pni/sse3/; $_} @flags; @flags = sort(@flags); $flag = join ' ', @flags if @flags; @@ -8722,6 +8733,7 @@ sub device_vendor { # 0 - match pattern; 1 - replace pattern; 2 - vendor print; 3 - serial pattern # Data URLs: inxi-resources.txt Section: DiskData device_vendor() # $model = 'MEDIAMAX '; + # $model = 'Patriot Memory'; my @vendors = ( ## These go first because they are the most likely and common ## ['(Crucial|^(FC)?CT|-CT|^M4\b)','Crucial','Crucial',''], @@ -8765,24 +8777,29 @@ sub device_vendor { # unknown: AL25744_12345678; ADP may be usb 2.5" adapter; udisk unknown: Z1E6FTKJ 00AAKS # SSD2SC240G726A10 MRS020A128GTS25C EHSAJM0016GB ['^5ACE','^5ACE','5ACE',''], # could be seagate: ST316021 5ACE + ['^Addlink','^Addlink','Addlink',''], ['^Aireye','^Aireye','Aireye',''], + ['^Alfawise','^Alfawise','Alfawise',''], ['^Android','^Android','Android',''], ['^Apotop','^Apotop','Apotop',''], # must come before AP|Apacer - ['^APPLE','^APPLE','Apple',''], + ['^(APPLE|iPod)','^APPLE','Apple',''], ['^(AP|Apacer)','^Apacer','Apacer',''], + ['^(A-?RAM|ARSSD)','^A-?RAM','A-RAM',''], ['^(ASM|2115)','^ASM','ASMedia',''],#asm1153e ['^Bell\b','^Bell','Packard Bell',''], ['^BHT','^BHT','BHT',''], ['^BIOSTAR','^BIOSTAR','Biostar',''], ['^BIWIN','^BIWIN','BIWIN',''], ['^BUFFALO','^BUFFALO','Buffalo',''], + ['^Centerm','^Centerm','Centerm',''], ['^CHN\b','','Zheino',''], ['^Clover','^Clover','Clover',''], ['^Colorful\b','^Colorful','Colorful',''], ['^CSD','^CSD','CSD',''], ['^(Dane-?Elec|Z Mate)','^Dane-?Elec','DaneElec',''], # Daplink vfs is an ARM software thing + ['^Dell\b','^Dell','Dell',''], ['^DeLOCK','^Delock(\s?products)?','Delock',''], ['^DGM','^DGM\b','DGM',''], ['^DIGITAL\s?FILM','DIGITAL\s?FILM','Digital Film',''], @@ -8807,6 +8824,7 @@ sub device_vendor { ['^(GOODRAM|IR SSD)','^GOODRAM','GOODRAM',''], # supertalent also has FM: |FM ['^(G[\.]?SKILL)','^G[\.]?SKILL','G.SKILL',''], + ['^HDC','^HDC\b','HDC',''], ['^Hectron','^Hectron','Hectron',''], ['^Hoodisk','^Hoodisk','Hoodisk',''], ['^HUAWEI','^HUAWEI','Huawei',''], @@ -8835,18 +8853,21 @@ sub device_vendor { ['^(LITE[\-\s]?ON[\s\-]?IT)','^LITE[\-]?ON[\s\-]?IT','LITE-ON IT',''], # LITEONIT_LSS-24L6G ['^(LITE[\-\s]?ON|PH[1-9])','^LITE[\-]?ON','LITE-ON',''], # PH6-CE240-L ['^M-Systems','^M-Systems','M-Systems',''], - ['^(MAXTOR|Atlas)','^MAXTOR','Maxtor',''], # note M3 is usually maxtor, but can be samsung + ['^(MAXTOR|Atlas)','^MAXTOR','Maxtor',''], # note M2 M3 is usually maxtor, but can be samsung ['^Memorex','^Memorex','Memorex',''], # note: C300/400 can be either micron or crucial, but C400 is M4 from crucial ['(^MT|^M5|^Micron|00-MT|C[34]00)','^Micron','Micron',''],# C400-MTFDDAK128MAM + ['^MARSHAL\b','^MARSHAL','Marshal',''], ['^MARVELL','^MARVELL','Marvell',''], ['^MDT\b','^MDT','MDT (rebuilt WD/Seagate)',''], # mdt rebuilds wd/seagate hdd ['^Medion','^Medion','Medion',''], ['^(MEDIAMAX|WL[0-9]{2})','^MEDIAMAX','MediaMax',''], + ['^Morebeck','^Morebeck','Morebeck',''], ['^Motorola','^Motorola','Motorola',''], ['^MTRON','^MTRON','MTRON',''], ['^Netac','^Netac','Netac',''], ['^OOS[1-9]','','Utania',''], + ['^OWC','^OWC\b','OWC',''], ['^PALIT','PALIT','Palit',''], # ssd ['^PERC\b','','Dell PowerEdge RAID Card',''], # ssd ['^(PS[8F]|Patriot)','^Patriot([-\s]?Memory)?','Patriot',''], @@ -8867,7 +8888,7 @@ sub device_vendor { # DIAMOND_040_GB ['^(SILICON\s?MOTION|SM[0-9])','^SILICON\s?MOTION','Silicon Motion',''], ['^(Silicon\s?Power|SP[CP]C|Silicon|Diamond|Haspeed)','Silicon\s?Power','Silicon Power',''], - ['Smartbuy','\s?Smartbuy','Smartbuy',''], # SSD Smartbuy 60GB + ['Smartbuy','\s?Smartbuy','Smartbuy',''], # SSD Smartbuy 60GB; mSata Smartbuy 3 # HFS128G39TND-N210A; seen nvme with name in middle ['(SK\s?HYNIX|^HFS)','\s?SK\s?HYNIX','SK Hynix',''], ['hynix','hynix','Hynix',''],# nvme middle of string, must be after sk hynix @@ -8877,6 +8898,7 @@ sub device_vendor { ['^(S[FR]-|Sony)','^Sony','Sony',''], ['^STE[CK]','^STE[CK]','sTec',''], # wd bought this one ['^STORFLY','^STORFLY','StorFly',''], + ['^SUNEAST','^SUNEAST','SunEast',''], # NOTE: F[MNETU] not reliable, g.skill starts with FM too: # Seagate ST skips STT. ['^(STT)','','Super Talent',''], @@ -8896,6 +8918,7 @@ sub device_vendor { # Twister Line but if we slice out Twister it would just say Line ['^(TrekStor|DS maxi)','^TrekStor','TrekStor',''], ['^UDinfo','^UDinfo','UDinfo',''], + ['^USBTech','^USBTech','USBTech',''], ['^(UG|Unigen)','^Unigen','Unigen',''], ['^VBOX','','VirtualBox',''], ['^(Verbatim|STORE N GO)','^Verbatim','Verbatim',''], @@ -17411,6 +17434,32 @@ sub get_kernel_bits { return $bits; } +sub get_kernel_parameters { + eval $start if $b_log; + my ($parameters); + if (my $file = system_files('cmdline') ) { + $parameters = get_kernel_parameters_linux($file); + } + elsif ($bsd_type) { + $parameters = get_kernel_parameters_bsd(); + } + eval $end if $b_log; + return $parameters; +} +sub get_kernel_parameters_linux { + eval $start if $b_log; + my ($file) = @_; + my $line = (reader($file))[0]; + eval $end if $b_log; + return $line; +} +sub get_kernel_parameters_bsd { + eval $start if $b_log; + my ($parameters); + eval $end if $b_log; + return $parameters; +} + sub get_memory_data_full { eval $start if $b_log; my ($source) = @_; @@ -18071,8 +18120,10 @@ sub pciconf_data { if ($_ =~ /^~$/) { $vendor = main::cleaner($vendor); $device = main::cleaner($device); + # handle possible regex in device name, like [ConnectX-3] + my $device_temp = main::regex_cleaner($device); if ($vendor && $device){ - if ($vendor !~ /$device/i){ + if (main::regex_cleaner($vendor) !~ /$device_temp/i){ $device = "$vendor $device"; } } @@ -19761,6 +19812,7 @@ sub generate_system_data { $data{$data_name}[$index]{main::key($num++,'Host')} = &get_hostname(); } $data{$data_name}[$index]{main::key($num++,'Kernel')} = &get_kernel_data(); + $data{$data_name}[$index]{main::key($num++,'bits')} = &get_kernel_bits; if ($extra > 0){ my @compiler = get_compiler_version(); # get compiler data @@ -19774,6 +19826,11 @@ sub generate_system_data { $data{$data_name}[$index]{main::key($num++,'v')} = $compiler[1]; } } + if ($b_admin && (my $params = get_kernel_parameters())){ + $index = scalar(@{ $data{$data_name} } ); + $data{$data_name}[$index]{main::key($num++,'parameters')} = $params; + $index = scalar(@{ $data{$data_name} } ); + } # note: tty can have the value of 0 but the two tools # return '' if undefined, so we test for explicit '' if ($b_display){ diff --git a/inxi.1 b/inxi.1 index b093c49..399c5b1 100644 --- a/inxi.1 +++ b/inxi.1 @@ -1,4 +1,4 @@ -.TH INXI 1 "2019\-03\-29" inxi "inxi manual" +.TH INXI 1 "2019\-04\-30" inxi "inxi manual" .SH NAME inxi \- Command line system information script for console and IRC .SH SYNOPSIS @@ -486,7 +486,8 @@ Examples: \fB\-W 95623,us\fR OR \fB\-W Boston,MA\fR OR \fB\-W 45.5234,\-122.6762\fR OR \fB\-W new+york,ny\fR OR \fB\-W bodo,norway\fR. DO NOT USE THIS FEATURE FOR AUTOMATED WEATHER UPDATES! Use of automated queries, -will result in your access being blocked. +will result in your access being blocked. If you try to work around the ban, you +will be permanently banned from this service. .TP .B \-\-weather\-source\fR, \fB\-\-ws \fR [\fB0\-9\fR] Switches weather data source. Possible values are \fB1\-9\fR. \fB1\-4\fR @@ -903,6 +904,11 @@ shows default value as well, e.g. \fBswappiness: 60 (default) cache pressure: 90 (default 100)\fR. +.TP +.B \-a \-S\fR +\- Adds kernel boot parameters to \fBKernel\fR section (if detected). Support +varies by OS type. + .SH ADVANCED OPTIONS .TP @@ -1035,6 +1041,11 @@ sort will be random. \fBused\fR - KiB used of partition. +.TP +.B \-\-pm\-type [package manager name]\fR +For distro package maintainers only, and only for non apt, rpm, or pacman based systems. +To be used to test replacement package lists for recommends for that package manager. + .TP .B \-\-sleep [0\-x.x]\fR Usually in decimals. Change CPU sleep time for \fB\-C\fR (current: \fB\0.35\fR). diff --git a/inxi.changelog b/inxi.changelog index 099e2fe..d9f40f5 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,81 @@ +===================================================================================== +Version: 3.0.34 +Patch: 00 +Date: 2019-04-30 +----------------------------------- +Changes: +----------------------------------- +New version, new man, new feature!! Bug fixes! + +Bugs: +1. issue #182 - in freebsd, there was an oversight in the pciconf parser, it +was using unfiltered strings as regex pattern, and of course, a string flipped +an error. Fix was to add the regex cleaner to the string before it's used in test. + +2. NOTE: issue #182 had a second bug, but the issue poster didn't follow up with +data or output so it couldn't be fixed. This was related to a syntax change in +usbdevs -v output in FreeBSD. Such changes are too common, but it might also +simply be a variant I have not seen or handled, but so far no data, so can't fix. +Don't blame me if you get this bug, but do post requested debugger data if you +want it fixed! + +Fixes: +1. Updated man for weather, explained more clearly how to use country codes for +weather output. More clarifying in general about weather location, and weather +restrictions. + +Enhancements: +1. Added avx/avx2 to default flag list in -C short form. Thanks damentz from +liquorix for clarifying why that was a good idea. Note the initial issue came up +in a Debian issue report, not here. People!! please post issues here, and don't bug +maintainers with feature requests! Maintainers aren't in a position to add a feature, +so you should go straight to the source. + +1.a. Created in inxi-perl/docs new doc file: cpu-flags.txt, which explains all +the flags, and also covers the short form flags and explains why they are used. + +2. To resolve another issue, I made a new documentation file: +inxi-perl/docs/inxi-custom-recommends.txt +This is instructions for maintainers of distros who do not use rpm/apt/pacman but +still want the --recommends feature to output their package pool package names for +missing packages. I decided to not allow more than the default 3 package managers +because no matter what people say, if I allow in more, the maintainer will vanish +or lose interest, and I'll be stuck having to maintain their package lists forever. + +Also, it's silly to even include that package list for any distro that does not +use rpm/apt/pacman, since the list is just wasted lines. Instructions in doc file +show what to change, and how, and has an example to make it clear. Odds of this +actually being used? Not high, lol, but that's fine, if people want it done, they +can do it, if not, nothing bad happens, it just won't show any suggested install +package, no big deal. + +3. Using the new disk vendor method, added even more disk vendors. Thanks +linux litet hardware database!! + +4. EXCITING!! A new --admin/-a option, suggested by a user on techpatterns.com/forums/ +Now -S or -b or -F with -a option for GNU/Linux shows the kernel boot parameters, +from /proc/cmdline. Didn't find anything comparable for BSDs, if you can tell me +where to look, I'll add it for those too, but wasn't anywhere I looked. Do the +BSDs even use that method? Don't know, but the logic is there, waiting to be used +if someone shows me how to get it cleanly. The 'parameters:' item shows in the main +'System:' -S output, and will just show the entire kernel parameters used to boot. + +This could be very helpful to distros who often have to determine if for example +graphics blacklists are correctly applied for non free drivers, like nomodeset etc, +or if the opposite is present. + +For forum/distro support, they just have to ask for: inxi -ba and they will see t +the relevant graphics info, for instance, or -SGaxxx, or -Faxxx, whatever is used +to trigger in this case the graphics and system lines. + +5. Updated man/help for 4 as well, now explains what they will see with --admin/ +-a options and -S. Good user suggestion, I wish all new features were this easy, +heh. + + +----------------------------------- +-- Harald Hope - Tue, 30 Apr 2019 17:37:10 -0700 + ===================================================================================== Version: 3.0.33 Patch: 00