diff options
| author | 2022-08-23 14:58:49 -0400 | |
|---|---|---|
| committer | 2022-08-23 14:58:49 -0400 | |
| commit | d64a171e7ad8dfe9b71be6bab71a6a42094f813c (patch) | |
| tree | 4860e4e0fef2d091da3816844511ab7018001a7b /inxi | |
| parent | d7d097a9dc59b6f4a429b6969d1a613d49d4c191 (diff) | |
| parent | 6bb70ff5f5b14d6e890d0eeb79f5dc370540a027 (diff) | |
Update upstream source from tag 'upstream/3.3.21-1'
Update to upstream version '3.3.21-1'
with Debian dir 4e5b537c607ecebb484c166383ebf956998f01ac
Diffstat (limited to 'inxi')
| -rwxr-xr-x | inxi | 555 |
1 files changed, 346 insertions, 209 deletions
@@ -48,8 +48,8 @@ use POSIX qw(ceil uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.3.20'; -my $self_date='2022-07-27'; +my $self_version='3.3.21'; +my $self_date='2022-08-22'; my $self_patch='00'; ## END INXI INFO ## @@ -3535,9 +3535,9 @@ sub item_data { 'JSON::PP' => { 'info' => '--output json (in CoreModules, but slower).', 'info-bsd' => '--output json (in CoreModules, but slower).', - 'apt' => 'libcpanel-json-xs-perl', - 'pacman' => 'perl-cpanel-json-xs', - 'rpm' => 'perl-Cpanel-JSON-XS', + 'apt' => 'libjson-pp-perl', + 'pacman' => 'perl-json-pp', + 'rpm' => 'perl-JSON-PP', }, 'JSON::XS' => { 'info' => '--output json (legacy).', @@ -3904,6 +3904,7 @@ sub set_program_values { 'calmwm' => ['^calmwm',0,'0','CalmWM',0,1,0,'',''], # unverified 'cardboard' => ['^cardboard',0,'0','Cardboard',0,1,0,'',''], # unverified 'catwm' => ['^catwm',0,'0','catwm',0,1,0,'',''], # unverified + 'cde' => ['^cde',0,'0','CDE',0,1,0,'',''], # unverified 'chameleonwm' => ['^chameleon',0,'0','ChameleonWM',0,1,0,'',''], # unverified 'cinnamon' => ['^cinnamon',2,'--version','Cinnamon',0,1,0,'',''], 'clfswm' => ['^clsfwm',0,'0','clfswm',0,1,0,'',''], # no version @@ -4009,6 +4010,7 @@ sub set_program_values { 'nawm' => ['^nawm',0,'0','nawm',0,1,0,'',''],# unverified 'newm' => ['^newm',0,'0','newm',0,1,0,'',''], # unverified 'notion' => ['^.',1,'--version','Notion',0,1,0,'',''], + 'nscde' => ['^nscde',0,'0','NsCDE',0,1,0,'',''], # unverified 'nucleus' => ['^nucleus',0,'0','Nucleus',0,1,0,'',''], # unverified 'openbox' => ['^openbox',2,'--version','Openbox',0,1,0,'',''], 'orbital' => ['^orbital',0,'0','Orbital',0,1,0,'',''],# unverified @@ -4897,6 +4899,7 @@ sub get { if ($arg >= 8){ $b_admin = 1; # $use{'downloader'} = 1; # only if weather + $force{'pkg'} = 1; $show{'edid'} = 1; $show{'process'} = 1; $show{'ps-cpu'} = 1; @@ -5217,7 +5220,8 @@ sub get { my ($opt,$arg) = @_; if ($arg){ my $wl = 'colors|cpuinfo|display|dmidecode|hddtemp|lsusb|man|meminfo|'; - $wl .= 'no-dig|no-doas|no-html-wan|no-sudo|pkg|usb-sys|vmstat|wayland|wmctrl'; + $wl .= 'no-dig|no-doas|no-html-wan|no-sudo|pkg|rpm||usb-sys|'; + $wl .= 'vmstat|wayland|wmctrl'; for (split(',',$arg)){ if ($_ =~ /\b($wl)\b/){ $force{lc($1)} = 1; @@ -5314,7 +5318,7 @@ sub get { else { main::error_handler('bad-arg', $opt, $arg); }}, - 'pkg' => sub { + 'pkg|rpm' => sub { $force{'pkg'} = 1;}, 'ppc' => sub { undef %risc; @@ -5424,6 +5428,10 @@ sub post_process { } $extra = 3 if $b_admin; $show{'graphic-basic'} = 0 if $show{'graphic-full'} && $extra > 1; + if ($force{'rpm'}){ + $force{'pkg'} = 1; + delete $force{'rpm'}; + } if ($use{'sensors-default'}){ @sensors_exclude = (); @sensors_use = (); @@ -5447,7 +5455,12 @@ sub post_process { $use{'logical'} = 1; } main::set_sudo() if ($show{'unmounted'} || ($extra > 0 && $show{'disk'})); - $use{'filter'} = 0 if $use{'filter-override'}; + if ($use{'filter-override'}){ + $use{'filter'} = 0; + $use{'filter-label'} = 0; + $use{'filter-uuid'} = 0; + $use{'filter-vulnerabilities'} = 0; + } # override for things like -b or -v2 to -v3 $show{'cpu-basic'} = 0 if $show{'cpu'}; $show{'optical-basic'} = 0 if $show{'optical'}; @@ -5754,43 +5767,6 @@ sub show_options { height. Greater than 0 shows x lines at a time."], ['0', '', '', "$line"], ['0', '', '', "Extra Data Options:"], - ['1', '-a', '--admin', "Adds advanced sys admin data (only works with - verbose or line output, not short form); check man page for explanations!; - also sets --extra=3:"], - ['2', '-A', '', "If available: list of alternate kernel modules/drivers - for device(s); PCIe lanes-max: gen, speed, lanes (if relevant)."], - ['2', '-C', '', "If available: CPU generation, process node, built years; CPU - socket type, base/boost speeds (dmidecode+root/sudo/doas required); Full - topology line, with cores, threads, threads per core, granular cache data, - smt status; CPU vulnerabilities (bugs); family, model-id, stepping - format: - hex (decimal) if greater than 9; microcode format: hex."], - ['2', '-d,-D', '', "If available: logical and physical block sizes; drive - family; maj:min, USB drive specifics; SMART report."], - ['2', '-E', '', "If available: in Report:, adds Info: line: acl-mtu, - sco-mtu, link-policy, link-mode, service-classes."], - ['2', '-G', '', "GPU process node, built year (AMD/Intel/Nvidia only); - non-free driver info (Nvidia only); PCIe lanes-max: gen, speed, lanes (if - relevant); list of alternate kernel modules/drivers for device(s) (if - available); Monitor built year, gamma, screen ratio (if available)."], - ['2', '-I', '', "As well as per package manager counts, also adds total - number of lib files found for each package manager if not -r; adds init - service tool."], - ['2', '-j,-p,-P', '', "For swap (if available): swappiness and vfs cache - pressure, and if values are default or not."], - ['2', '-L', '', "LV, Crypto, devices, components: add maj:min; show - full device/components report (speed, mapped names)."], - ['2', '-m', '', "Show full volts report, current, min, max, even if - identical."], - ['2', '-n,-N', '', "If available: list of alternate kernel modules/drivers - for device(s); PCIe lanes-max: gen, speed, lanes (if relevant)."], - ['2', '-o', '', "If available: maj:min of device."], - ['2', '-p,-P', '', "If available: raw size of ${partition_string}s, maj:min, - percent available for user, block size of file system (root required)."], - ['2', '-r', '', "Packages, see -Ia."], - ['2', '-R', '', "mdraid: device maj:min; per component: size, maj:min, state."], - ['2', '-S', '', "If available: kernel boot parameters."], - ['2', '', '--slots', "If available: slot bus ID children."], - ['0', '', '', ''], ['1', '-x', '--extra', "Adds the following extra data (only works with verbose or line output, not short form):"], ['2', '-A', '', "Specific vendor/product information (if relevant); @@ -5820,7 +5796,7 @@ sub show_options { ['2', '-I', '', "Default system GCC. With -xx, also shows other installed GCC versions. If running in shell, not in IRC client, shows shell version number, if detected. Init/RC type and runlevel/target (if available). Total - count of all packages discovered in system and not -r."], + count of all packages discovered in system (if not -r)."], ['2', '-j', '', "Add mapped: name if partition mapped."], ['2', '-J', '', "For Device: driver."], ['2', '-L', '', "For VG > LV, and other Devices, dm:"], @@ -5852,6 +5828,7 @@ sub show_options { ['2', '-A', '', "Chip vendor:product ID for each audio device; PCIe speed, lanes (if found)."], ['2', '-B', '', "Serial number."], + ['2', '-C', '', "Add microarchitecture level."], ['2', '-D', '', "Disk transfer speed; NVMe lanes; Disk serial number; LVM volume group free space (if available); disk duid (some BSDs)."], ['2', '-E', '', "Chip vendor:product ID, LMP subversion; PCIe speed, lanes @@ -5866,7 +5843,7 @@ sub show_options { ['2', '-I', '', "Other detected installed gcc versions (if present). System default target/runlevel. Adds parent program (or pty/tty) for shell info if not in IRC. Adds Init version number, RC (if found). Adds per package manager - installed package counts if not -r."], + installed package counts (if not -r)."], ['2', '-j,-p,-P', '', "Swap priority."], ['2', '-J', '', "Vendor:chip-ID."], ['2', '-L', '', "Show internal LVM volumes, like raid image/meta volumes; @@ -5928,6 +5905,44 @@ sub show_options { ); } push(@$rows, + ['0', '', '', ''], + ['1', '-a', '--admin', "Adds advanced sys admin data (only works with + verbose or line output, not short form); check man page for explanations!; + also sets --extra=3:"], + ['2', '-A', '', "If available: list of alternate kernel modules/drivers + for device(s); PCIe lanes-max: gen, speed, lanes (if relevant)."], + ['2', '-C', '', "If available: CPU generation, process node, built years; CPU + socket type, base/boost speeds (dmidecode+root/sudo/doas required); Full + topology line, with cores, threads, threads per core, granular cache data, + smt status; CPU vulnerabilities (bugs); family, model-id, stepping - format: + hex (decimal) if greater than 9; microcode format: hex."], + ['2', '-d,-D', '', "If available: logical and physical block sizes; drive + family; maj:min, USB drive specifics; SMART report."], + ['2', '-E', '', "If available: in Report:, adds Info: line: acl-mtu, + sco-mtu, link-policy, link-mode, service-classes."], + ['2', '-G', '', "GPU process node, built year (AMD/Intel/Nvidia only); + non-free driver info (Nvidia only); PCIe lanes-max: gen, speed, lanes (if + relevant); list of alternate kernel modules/drivers for device(s) (if + available); Monitor built year, gamma, screen ratio (if available)."], + ['2', '-I', '', "Adds to Packages total number of lib files found for each + package manager and pm tools (if not -r); adds init service tool."], + ['2', '-j,-p,-P', '', "For swap (if available): swappiness and vfs cache + pressure, and if values are default or not."], + ['2', '-L', '', "LV, Crypto, devices, components: add maj:min; show + full device/components report (speed, mapped names)."], + ['2', '-m', '', "Show full volts report, current, min, max, even if + identical."], + ['2', '-n,-N', '', "If available: list of alternate kernel modules/drivers + for device(s); PCIe lanes-max: gen, speed, lanes (if relevant)."], + ['2', '-o', '', "If available: maj:min of device."], + ['2', '-p,-P', '', "If available: raw size of ${partition_string}s, maj:min, + percent available for user, block size of file system (root required)."], + ['2', '-r', '', "Packages, see -Ia."], + ['2', '-R', '', "mdraid: device maj:min; per component: size, maj:min, state."], + ['2', '-S', '', "If available: kernel boot parameters."], + ['2', '', '--slots', "If available: slot bus ID children."], + ); + push(@$rows, [0, '', '', "$line"], [0, '', '', "Additional Options:"], ['1', '-h', '--help', "This help menu."], @@ -6002,9 +6017,9 @@ sub show_options { (Wget/Fetch/Curl/Perl-HTTP::Tiny)."], ['1', '', '--no-sudo', "Skip internal program use of sudo features (not related to starting $self_name with sudo)."], - ['1', '', '--pkg', "Force use of disabled package manager counts for packages - feature. RPM disabled by default due to possible massive rpm package query - times."], + ['1', '', '--rpm', "Force use of disabled package manager counts for packages + feature with -rx/-Ix. RPM disabled by default due to slow to massive RPM + package query times."], ['1', '', '--sensors-default', "Removes configuration item SENSORS_USE and SENSORS_EXCLUDE. Same as default behavior."], ['1', '', '--sensors-exclude', "[sensor[s] name, comma separated] Exclude @@ -6787,7 +6802,7 @@ sub message { 'pci-card-data' => 'No PCI device data found.', 'pci-card-data-root' => 'PCI device data requires root.', 'pci-slot-data' => 'No PCI Slot data found.', - 'pm-disabled' => 'see --pkg', + 'pm-rpm-disabled' => 'see --rpm', 'ps-data-null' => 'No process data available.', 'raid-data' => 'No RAID data found.', 'ram-data' => 'No RAM data found.', @@ -7240,7 +7255,7 @@ sub print_data { foreach (@values){ # my $l = (length("$_ ") + $length); # print "$l\n"; - $indent_use = ($b_row1) ? $indent : $indent_2; + $indent_use = ($b_row1 || $b_ni2) ? $indent : $indent_2; if ((length("$_ ") + $length) < $size{'max-cols'}){ # print "h-2: r1: $b_row1 iu: $indent_use\n"; # print "a\n"; @@ -8726,10 +8741,13 @@ sub full_output { if ($cpu->{'arch-note'}){ $rows->[$j]{main::key($num++,0,3,'note')} = $cpu->{'arch-note'}; } + if ($b_admin && $cpu->{'gen'}){ + $rows->[$j]{main::key($num++,0,3,'gen')} = $cpu->{'gen'}; + } + if ($extra > 1 && $properties->{'arch-level'}){ + $rows->[$j]{main::key($num++,0,2,'level')} = $properties->{'arch-level'}; + } if ($b_admin){ - if ($cpu->{'gen'}){ - $rows->[$j]{main::key($num++,0,3,'gen')} = $cpu->{'gen'}; - } if ($cpu->{'year'}){ $rows->[$j]{main::key($num++,0,2,'built')} = $cpu->{'year'}; } @@ -8752,7 +8770,6 @@ sub full_output { elsif (defined $cpu->{'revision'}){ $rows->[$j]{main::key($num++,0,2,'rev')} = $cpu->{'revision'}; } - if (!%risc && $cpu->{'type'} ne 'elbrus'){ $cpu->{'microcode'} = ($cpu->{'microcode'}) ? '0x' . $cpu->{'microcode'} : 'N/A'; $rows->[$j]{main::key($num++,0,2,'microcode')} = $cpu->{'microcode'}; @@ -10141,7 +10158,7 @@ sub dmidecode_data { ## CPU PROPERTIES MAIN ## sub cpu_properties { my ($cpu) = @_; - my ($cpu_sys); + my ($cpu_sys,$arch_level); my $dmi_data = {}; my $tests = {}; my $caches = { @@ -10269,13 +10286,21 @@ sub cpu_properties { ## START SPEED/BITS ## my $speed_info = cp_speed_data($cpu,$cpu_sys); - if (!$bits_sys && !%risc && $cpu->{'flags'}){ + # seen case where 64 bit cpu with lm flag shows as i686 (tinycore) + if (!%risc && $cpu->{'flags'} && (!$bits_sys || $bits_sys == 32)){ $bits_sys = ($cpu->{'flags'} =~ /\blm\b/) ? 64 : 32; } + # must run after to make sure we have cpu bits + if (!%risc && $bits_sys && $bits_sys == 64 && $cpu->{'flags'}){ + $arch_level = cp_cpu_level( + $cpu->{'flags'} + ); + } ## END SPEED/BITS ## ## LOAD %cpu_properties my $cpu_properties = { + 'arch-level' => $arch_level, 'avg-speed-key' => $speed_info->{'avg-speed-key'}, 'bits-sys' => $bits_sys, 'cache' => $caches->{'cache'}, @@ -10995,7 +11020,7 @@ sub cp_cpu_arch { elsif ($family eq '19'){ # ext model 6,7, but no base models yet # 10 engineering sample - if ($model =~ /^(10|6\d|7\d)$/){ + if ($model =~ /^(10|[67][0-9A-F])$/){ $arch = 'Zen 4'; $gen = '5'; $process = 'TSMC n5 (5nm)'; @@ -11418,16 +11443,16 @@ sub cp_cpu_arch { elsif ($model =~ /^(8F)$/){ $arch = 'Sapphire Rapids'; $process = 'Intel 7 (10nm ESF)'; - $year = '2021';} # server + $year = '2021+';} # server elsif ($model =~ /^(97|9A)$/){ $arch = 'Alder Lake'; # socket LG 1700 $process = 'Intel 7 (10nm ESF)'; - $year = '2021';} + $year = '2021+';} ## IDS UNKNOWN, release late 2022 # elsif ($model =~ /^()$/){ # $arch = 'Raptor Lake'; # 13 gen, socket LG 1700,1800 # $process = 'Intel 7 (10nm)'; - # $year = '2022';} + # $year = '2022+';} # elsif ($model =~ /^()$/){ # $arch = 'Meteor Lake'; # 14 gen # $process = 'Intel 4';} @@ -11530,6 +11555,30 @@ sub cp_cpu_arch { return [$arch,$note,$process,$gen,$year]; } ## END CPU ARCH ## + +# Only AMD/Intel 64 bit cpus +sub cp_cpu_level { + eval $start if $b_log; + my ($flags) = @_; + my $level; + if ($flags =~ /AVX512/i){ + $level = 'v4'; + } + # ~2015: Haswell and Excavator + elsif ($flags =~ /\b(AVX2|BMI[12]|F16C|FMA|LZCNT|MOVBE|OSXSAVE)\b/i){ + $level = 'v3'; + } + # !2009: Nehalem and Jaguar + elsif ($flags =~ /\b(CMPXCHG16B|[LS]AHF|POPCNT|SSS?E3|SSE4_[12])\b/i){ + $level = 'v2'; + } + # baseline: all x86_64 cpus + elsif ($flags =~ /\b(CX8|FPU|FXSR|MMX|OSFXSR|SCE|SSE2?)\b/i){ + $level = 'v1'; + } + eval $end if $b_log; + return $level; +} sub cp_cpu_topology { my ($counts,$topology) = @_; my @alpha = qw(Single Dual Triple Quad); @@ -15937,10 +15986,11 @@ sub set_amd_data { 'years' => '2010-13', }, {'arch' => 'GCN-1', - 'ids' => '154c|6600|6601|6604|6605|6606|6607|6608|6609|6610|6611|6613|6631|' . - '6660|6663|6664|6665|6667|666f|6780|6784|6788|678a|6798|679a|679b|679e|679f|' . - '6800|6801|6802|6806|6808|6809|6810|6811|6816|6817|6818|6819|6820|6821|6822|' . - '6823|6825|6826|6827|6828|6829|682a|682b|682c|682d|682f|6835|6837|683d|683f', + 'ids' => '154c|6600|6601|6604|6605|6606|6607|6608|6609|6610|6611|6613|6617|' . + '6631|6660|6663|6664|6665|6667|666f|6780|6784|6788|678a|6798|679a|679b|679e|' . + '679f|6800|6801|6802|6806|6808|6809|6810|6811|6816|6817|6818|6819|6820|6821|' . + '6822|6823|6825|6826|6827|6828|6829|682a|682b|682c|682d|682f|6835|6837|683d|' . + '683f', 'code' => 'Southern Islands', 'process' => 'TSMC 28nm', 'years' => '2011-20', @@ -16139,7 +16189,7 @@ sub set_intel_data { 'years' => '2019-21', }, {'arch' => 'Gen-12.1', - 'ids' => '4905|4908|4c8a|4c8b|4c90|4c9a|9a40|9a49|9a60|9a68|9a70|9a78', + 'ids' => '4905|4908|4909|4c8a|4c8b|4c90|4c9a|9a40|9a49|9a60|9a68|9a70|9a78', 'code' => '', 'process' => 'Intel 10nm', 'years' => '2020-21', @@ -22049,7 +22099,7 @@ sub set_ram_vendors { # before patriot just in case ['^(MN\d|PNY)','PNY\s','PNY',''], ['^(P[A-Z]|Patriot)','Patriot','Patriot',''], - ['^(K[1-6][ABT]|K[1-6][\d]{3}|M[\d]{3}[A-Z]|Samsung)','Samsung','Samsung',''], + ['^(K[1-6][ABLT]|K\d|M[\d]{3}[A-Z]|Samsung)','Samsung','Samsung',''], ['^(SP|Silicon[\s-]?Power)','Silicon[\s-]?Power','Silicon Power',''], ['^(STK|Simtek)','Simtek','Simtek',''], ['^(HM[ACT]|SK[\s-]?Hynix)','SK[\s-]?Hynix','SK-Hynix',''], @@ -22058,7 +22108,7 @@ sub set_ram_vendors { ['^(T[^\dR]|Team[\s-]?Group)','Team[\s-]?Group','TeamGroup',''], ['^(TR\d|JM\d|Transcend)','Transcend','Transcend',''], ['^(VK\d|Vaseky)','Vaseky','Vaseky',''], - ['^(Yangtze|Zhitai)','Yangtze(\s*Memory)?','Yangtze Memory',''], + ['^(Yangtze|Zhitai|YMTC)','(Yangtze(\s*Memory)?|YMTC)','YMTC',''], ]; } # note: many of these are pci ids, not confirmed valid for ram @@ -22067,6 +22117,7 @@ sub set_ram_vendor_ids { '01f4' => 'Transcend',# confirmed '02fe' => 'Elpida',# confirmed '0314' => 'Mushkin',# confirmed + '0420' => 'Chips and Technologies', '1014' => 'IBM', '1099' => 'Samsung', '10c3' => 'Samsung', @@ -22080,6 +22131,7 @@ sub set_ram_vendor_ids { '1b85' => 'OCZ', '1c5c' => 'SK-Hynix', '1cc1' => 'A-Data', + '1e49' => 'YMTC',# Yangtze Memory confirmed '0215' => 'Corsair',# confirmed '2646' => 'Kingston', '2c00' => 'Micron',# confirmed @@ -22892,8 +22944,8 @@ sub repo_data { 'portsnap-missing' => 'No ports servers in', 'scratchpkg-active' => 'scratchpkg repos in', 'scratchpkg-missing' => 'No active scratchpkg repos in', - 'slackpkg-active' => 'slackpkg repos in', - 'slackpkg-missing' => 'No active slackpkg repos in', + 'slackpkg-active' => 'slackpkg mirror in', + 'slackpkg-missing' => 'No slackpkg mirror set in', 'slackpkg+-active' => 'slackpkg+ repos in', 'slackpkg+-missing' => 'No active slackpkg+ repos in', 'slaptget-active' => 'slapt-get repos in', @@ -22973,9 +23025,8 @@ my $sensors_raw = {}; sub get { eval $start if $b_log; my ($b_data,$key1,$program,$val1,$sensors); - my $rows = []; - my $num = 0; - my $source = 'sensors'; + my ($num,$rows) = (0,[]); + my $source = 'sensors'; # will trip some type output if ipmi + another type # we're allowing 1 or 2 ipmi tools, first the gnu one, then the # almost certain to be present in BSDs if ($fake{'ipmi'} || (main::globber('/dev/ipmi**') && @@ -23030,6 +23081,7 @@ sub get { $val1 = main::message('sensors-data-linux'); push(@$rows,{main::key($num++,0,1,$key1) => $val1}); } + } } eval $end if $b_log; @@ -23039,10 +23091,9 @@ sub sensors_output { eval $start if $b_log; my ($rows,$source,$sensors) = @_; my ($b_result,@fan_default,@fan_main); - my ($data_source) = (''); my $fan_number = 0; my $num = 0; - my $j = 0; + my $j = scalar @$rows; if (!$loaded{'gpu-data'} && ($source eq 'sensors' || $source eq 'lm-sensors')){ gpu_sensor_data(); @@ -23054,7 +23105,7 @@ sub sensors_output { my $cpu_temp = (defined $sensors->{'cpu-temp'}) ? $sensors->{'cpu-temp'} . $temp_unit: 'N/A'; my $mobo_temp = (defined $sensors->{'mobo-temp'}) ? $sensors->{'mobo-temp'} . $temp_unit: 'N/A'; my $cpu1_key = ($sensors->{'cpu2-temp'}) ? 'cpu-1': 'cpu' ; - $data_source = $source if ($source eq 'ipmi' || $source eq 'lm-sensors'); + my $data_source = ($source eq 'ipmi' || $source eq 'lm-sensors') ? $source : ''; push(@$rows, { main::key($num++,1,1,'System Temperatures') => $data_source, main::key($num++,0,2,$cpu1_key) => $cpu_temp, @@ -23209,18 +23260,22 @@ sub ipmi_data { my ($b_ipmitool,$i_key,$i_value,$i_unit); my $sensors = {}; if ($fake{'ipmi'}){ + ## ipmitool ## # $file = "$fake_data_dir/ipmitool/ipmitool-sensors-archerseven-1.txt";$program='ipmitool'; - # $file = "$fake_data_dir/ipmitool/ipmitool-sensors-crazy-epyc-1.txt";$program='ipmitool'; + # $file = "$fake_data_dir/ipmitool/ipmitool-sensors-epyc-1.txt";$program='ipmitool'; # $file = "$fake_data_dir/ipmitool/ipmitool-sensors-RK016013.txt";$program='ipmitool'; # $file = "$fake_data_dir/ipmitool/ipmitool-sensors-freebsd-offsite-backup.txt"; - # $file = "$fake_data_dir/ipmitool/ipmitool-sensor-tyan-1.txt"; - # $file = "$fake_data_dir/ipmitool/ipmi-sensors-crazy-epyc-1.txt"; - # $file = "$fake_data_dir/ipmitool/ipmi-sensors-lathander.txt"; - # $file = "$fake_data_dir/ipmitool/ipmi-sensors-zwerg.txt"; - # $file = "$fake_data_dir/ipmitool/ipmi-sensors-arm-server-1.txt"; - # @data = main::reader($file); - # ($b_ipmitool,$i_key,$i_value,$i_unit) = (0,1,3,4); # ipmi-sensors + # $file = "$fake_data_dir/ipmitool/ipmitool-sensor-shom-1.txt";$program='ipmitool'; + # $file = "$fake_data_dir/ipmitool/ipmitool-sensor-shom-2.txt";$program='ipmitool'; + # $file = "$fake_data_dir/ipmitool/ipmitool-sensor-tyan-1.txt";$program='ipmitool'; # ($b_ipmitool,$i_key,$i_value,$i_unit) = (1,0,1,2); # ipmitool sensors + ## ipmi-sensors ## + # $file = "$fake_data_dir/ipmitool/ipmi-sensors-epyc-1.txt";$program='ipmi-sensors'; + # $file = "$fake_data_dir/ipmitool/ipmi-sensors-lathander.txt";$program='ipmi-sensors'; + # $file = "$fake_data_dir/ipmitool/ipmi-sensors-zwerg.txt";$program='ipmi-sensors'; + # $file = "$fake_data_dir/ipmitool/ipmi-sensors-arm-server-1.txt";$program='ipmi-sensors'; + # ($b_ipmitool,$i_key,$i_value,$i_unit) = (0,1,3,4); # ipmi-sensors + # @data = main::reader($file); } else { if ($program =~ /ipmi-sensors$/){ @@ -23228,7 +23283,7 @@ sub ipmi_data { ($b_ipmitool,$i_key,$i_value,$i_unit) = (0,1,3,4); } else { # ipmitool - $cmd = "$program sensors"; + $cmd = "$program sensor"; # note: 'sensor' NOT 'sensors' !! ($b_ipmitool,$i_key,$i_value,$i_unit) = (1,0,1,2); } @data = main::grabber("$cmd 2>/dev/null"); @@ -23236,7 +23291,7 @@ sub ipmi_data { # print join("\n", @data), "\n"; # shouldn't need to log, but saw a case with debugger ipmi data, but none here apparently main::log_data('dump','ipmi @data',\@data) if $b_log; - return if !@data; + return $sensors if !@data; foreach (@data){ next if /^\s*$/; # print "$_\n"; @@ -23244,13 +23299,13 @@ sub ipmi_data { # print "$row[$i_value]\n"; next if !main::is_numeric($row[$i_value]); # print "$row[$i_key] - $row[$i_value]\n"; - if (!$sensors->{'mobo-temp'} && $row[$i_key] =~ /^(MB_TEMP[0-9]|System[\s_]Temp|System[\s_]?Board([\s_]Temp)?)$/i){ + if (!$sensors->{'mobo-temp'} && $row[$i_key] =~ /^(MB[\s_-]?TEMP[0-9]|System[\s_-]?Temp|System[\s_-]?Board([\s_-]?Temp)?)$/i){ $sensors->{'mobo-temp'} = int($row[$i_value]); $working_unit = $row[$i_unit]; $working_unit =~ s/degrees\s// if $b_ipmitool; $sensors->{'temp-unit'} = set_temp_unit($sensors->{'temp-unit'},$working_unit) if $working_unit; } - elsif ($row[$i_key] =~ /^(System\s)?(Ambient)([\s_]Temp)?$/i){ + elsif ($row[$i_key] =~ /^(System[\s_-]?)?(Ambient)([\s_-]?Temp)?$/i){ $sensors->{'ambient-temp'} = int($row[$i_value]); $working_unit = $row[$i_unit]; $working_unit =~ s/degrees\s// if $b_ipmitool; @@ -23259,14 +23314,14 @@ sub ipmi_data { # Platform Control Hub (PCH), it is the X370 chip on the Crosshair VI Hero. # VRM: voltage regulator module # NOTE: CPU0_TEMP CPU1_TEMP is possible, unfortunately; CPU Temp Interf - elsif (!$sensors->{'cpu-temp'} && $row[$i_key] =~ /^CPU([01])?([\s_](below[\s_]Tmax|Temp))?$/i){ + elsif (!$sensors->{'cpu-temp'} && $row[$i_key] =~ /^CPU[\s_-]?([01])?([\s_](below[\s_]Tmax|Temp))?$/i){ $b_cpu_0 = 1 if defined $1 && $1 == 0; $sensors->{'cpu-temp'} = int($row[$i_value]); $working_unit = $row[$i_unit]; $working_unit =~ s/degrees\s// if $b_ipmitool; $sensors->{'temp-unit'} = set_temp_unit($sensors->{'temp-unit'},$working_unit) if $working_unit; } - elsif ($row[$i_key] =~ /^CPU([1-4])([\s_](below[\s_]Tmax|Temp))?$/i){ + elsif ($row[$i_key] =~ /^CPU[\s_-]?([1-4])([\s_](below[\s_]Tmax|Temp))?$/i){ $temp_working = $1; $temp_working++ if $b_cpu_0; $sensors->{"cpu${temp_working}-temp"} = int($row[$i_value]); @@ -23275,7 +23330,7 @@ sub ipmi_data { $sensors->{'temp-unit'} = set_temp_unit($sensors->{'temp-unit'},$working_unit) if $working_unit; } # for temp1/2 only use temp1/2 if they are null or greater than the last ones - elsif ($row[$i_key] =~ /^(MB[_]?TEMP1|Temp[\s_]1)$/i){ + elsif ($row[$i_key] =~ /^(MB[\s_-]?TEMP1|Temp[\s_]1)$/i){ $temp_working = int($row[$i_value]); $working_unit = $row[$i_unit]; $working_unit =~ s/degrees\s// if $b_ipmitool; @@ -23303,8 +23358,8 @@ sub ipmi_data { } $sensors->{'temp-unit'} = set_temp_unit($sensors->{'temp-unit'},$working_unit) if $working_unit; } - elsif (!$sensors->{'sodimm-temp'} && ($row[$i_key] =~ /^(DIMM[-_]([A-Z][0-9][-_])?[A-Z]?[0-9][A-Z]?)$/i || - $row[$i_key] =~ /^DIMM[0-9] Area.*/)){ + elsif (!$sensors->{'sodimm-temp'} && ($row[$i_key] =~ /^(DIMM[-_]([A-Z][0-9]+[-_])?[A-Z]?[0-9]+[A-Z]?)$/i || + $row[$i_key] =~ /^DIMM\s?[0-9]+ (Area|Temp).*/)){ $sensors->{'sodimm-temp'} = int($row[$i_value]); $working_unit = $row[$i_unit]; $working_unit =~ s/degrees\s// if $b_ipmitool; @@ -23346,13 +23401,13 @@ sub ipmi_data { $sensors->{'fan-psu-2'} = int($row[$i_value]); } if ($extra > 0){ - if ($row[$i_key] =~ /^((MAIN\s|P[_]?)?\+?12V|PSU[12]_VOUT)$/i){ + if ($row[$i_key] =~ /^((.+\s|P[_]?)?\+?12V|PSU[12]_VOUT)$/i){ $sensors->{'volts-12'} = $row[$i_value]; } - elsif ($row[$i_key] =~ /^(MAIN\s5V|P5V|5VCC|5V( PG)?|5V_SB)$/i){ + elsif ($row[$i_key] =~ /^(.+\s5V|P5V|5VCC|5V( PG)?|5V_SB)$/i){ $sensors->{'volts-5'} = $row[$i_value]; } - elsif ($row[$i_key] =~ /^(MAIN\s3\.3V|P3V3|3\.3VCC|3\.3V( PG)?|3V3_SB)$/i){ + elsif ($row[$i_key] =~ /^(.+\s3\.3V|P3V3|3\.3VCC|3\.3V( PG)?|3V3_SB)$/i){ $sensors->{'volts-3.3'} = $row[$i_value]; } elsif ($row[$i_key] =~ /^((P_)?VBAT|CMOS Battery|BATT 3.0V)$/i){ @@ -23943,7 +23998,7 @@ sub process_data { for ($j = 1; $j <= $index_count_fan_default; $j++){ if (defined $fan_default[$j] && $fan_default[$j] > 5000 && !$fan_main[2]){ $fan_main[2] = $fan_default[$j]; - $fan_default[$j] = ''; + $fan_default[$j] = undef; # then add one if required for output if ($index_count_fan_main < 2){ $index_count_fan_main = 2; @@ -26388,9 +26443,9 @@ sub get_ps_de_data { # unverfied: 2bwm catwm mcwm penrose snapwm uwm wmfs wmfs2 wingo wmii2 # xfdesktoo is fallback in case not in xprop my @wms = qw(icewm 2bwm 9wm aewm aewm\+\+ afterstep amiwm antiwm awesome - blackbox bspwm calmwm catwm ctwm dwm echinus evilwm fluxbox fvwm + blackbox bspwm calmwm catwm cde ctwm dwm echinus evilwm fluxbox fvwm hackedbox herbstluftwm instantwm i3 ion3 jbwm jwm larswm leftwm lwm - matchbox-window-manager mcwm mini musca mvwm mwm nawm notion + matchbox-window-manager mcwm mini musca mvwm mwm nawm notion nscde openbox pekwm penrose qvwm ratpoison sawfish scrotwm snapwm spectrwm tinywm tvtwm twm uwm windowlab wmfs wmfs2 wingo wmii2 wmii wmx xmonad yeahwm); @@ -27853,8 +27908,8 @@ sub get_linux_distro { my @derived = qw(antix-version aptosid-version bodhibuilder.conf kanotix-version knoppix-version pclinuxos-release mandrake-release manjaro-release mx-version pardus-release porteus-version q4os_version sabayon-release siduction-version - sidux-version slint-version slitaz-release solusos-release turbolinux-release - zenwalk-version);# + sidux-version slax-version slint-version slitaz-release solusos-release + turbolinux-release zenwalk-version); my $derived_s = join('|', @derived); my @primary = qw(altlinux-release arch-release gentoo-release redhat-release slackware-version SuSE-release); @@ -28128,13 +28183,15 @@ sub system_base_bsd { sub system_base { eval $start if $b_log; - my $base_arch_distro = 'anarchy|antergos|arch(bang|craft|labs|man|strike)|arco|artix'; + my $base_distro_arch = 'anarchy|antergos|arch(bang|craft|labs|man|strike)|arco|artix'; # note: arch linux derived distro page claims kaos as arch derived but it is NOT - $base_arch_distro .= '|blackarch|bluestar|chakra|ctios|endeavour|garuda|hyperbola|linhes'; - $base_arch_distro .= '|mabox|manjaro|mysys2|netrunner\s?rolling|ninja|obarun|parabola'; - $base_arch_distro .= '|puppyrus-?a|reborn|snal|talkingarch|ubos'; - my $base_debian_version_distro = 'sidux'; - my $base_debian_version_osr = '\belive|lmde|neptune|parrot|pureos|rescatux|septor|sparky|tails'; + $base_distro_arch .= '|blackarch|bluestar|chakra|ctios|endeavour|garuda|hyperbola|linhes'; + $base_distro_arch .= '|mabox|manjaro|mysys2|netrunner\s?rolling|ninja|obarun|parabola'; + $base_distro_arch .= '|puppyrus-?a|reborn|snal|steamos|talkingarch|ubos'; + my $base_file_debian_version = 'sidux'; + # detect debian steamos before arch steamos + my $base_osr_debian_version = '\belive|lmde|neptune|parrot|pureos|rescatux|'; + $base_osr_debian_version .= 'septor|sparky|steamos|tails'; # osr has base ids my $base_default = 'antix-version|mx-version'; # base only found in issue @@ -28142,12 +28199,12 @@ sub system_base { # synthesize, no direct data available my $base_manual = 'blankon|deepin|kali'; # osr base, distro id in list of distro files - my $base_osr = 'aptosid|grml|q4os|siduction|bodhi'; + my $base_osr = 'aptosid|bodhi|grml|q4os|siduction|slax'; # osr base, distro id in issue my $base_osr_issue = 'grml|linux lite|openmediavault'; # osr has distro name but has fedora centos redhat ID_LIKE and VERSION_ID same my $base_osr_redhat = 'almalinux|centos|rocky'; - # osr has distro name but has ubuntu ID_LIKE/UBUNTU_CODENAME + # osr has distro name but has ubuntu ID_LIKE/UBUNTU_CODENAME my $base_osr_ubuntu = 'mint|neon|nitrux|pop!_os|zorin'; my $base_upstream_lsb = '/etc/upstream-release/lsb-release'; my $base_upstream_osr = '/etc/upstream-release/os-release'; @@ -28171,6 +28228,7 @@ sub system_base { elsif (-r $base_upstream_lsb){ $system_base = get_lsb_release($base_upstream_lsb); } + # probably no need for these @osr greps, just grep $distro instead? if (!$system_base && @osr){ my ($base_type) = (''); if ($etc_issue && (grep {/($base_issue)/i} @osr)){ @@ -28180,8 +28238,8 @@ sub system_base { elsif (@distro_files && (grep {/($base_default)/} @distro_files)){ $base_type = 'default'; } - # must go before base_osr_ubuntu test - elsif (grep {/($base_debian_version_osr)/i} @osr){ + # must go before base_osr_arch,ubuntu tests. For steamos, use fallback arch + elsif (grep {/($base_osr_debian_version)/i} @osr){ $system_base = debian_id(); } elsif (grep {/($base_osr_redhat)/i} @osr){ @@ -28200,7 +28258,7 @@ sub system_base { } } if (!$system_base && @distro_files && - (grep {/($base_debian_version_distro)/i} @distro_files)){ + (grep {/($base_file_debian_version)/i} @distro_files)){ $system_base = debian_id(); } if (!$system_base && $lc_issue && $lc_issue =~ /($base_manual)/){ @@ -28212,7 +28270,7 @@ sub system_base { ); $system_base = $manual{$id}; } - if (!$system_base && $distro && $distro =~ /^($base_arch_distro)/i){ + if (!$system_base && $distro && $distro =~ /^($base_distro_arch)/i){ $system_base = 'Arch Linux'; } if (!$system_base && $distro){ @@ -28286,8 +28344,9 @@ sub get_lsb_release { sub get_os_release { eval $start if $b_log; my ($base_type) = @_; - my ($base_id,$base_name,$base_version,$distro,$distro_name,$pretty_name, - $lc_name,$name,$version_name,$version_id) = ('','','','','','','','','',''); + my ($base_id,$base_name,$base_version,$distro,$distro_name, + $name,$name_lc,$name_pretty, + $version_codename,$version_name,$version_id) = ('','','','','','','','','','',''); my @content = @osr; main::log_data('dump','@content',\@content) if $b_log; @content = map {s/\\||\"|[:\47]|^\s+|\s+$|n\/a//ig; $_} @content if @content; @@ -28296,11 +28355,14 @@ sub get_os_release { my @working = split(/\s*=\s*/, $_); next if !$working[0]; if ($working[0] eq 'PRETTY_NAME' && $working[1]){ - $pretty_name = $working[1]; + $name_pretty = $working[1]; } elsif ($working[0] eq 'NAME' && $working[1]){ $name = $working[1]; - $lc_name = lc($name); + $name_lc = lc($name); + } + elsif ($working[0] eq 'VERSION_CODENAME' && $working[1]){ + $version_codename = $working[1]; } elsif ($working[0] eq 'VERSION' && $working[1]){ $version_name = $working[1]; @@ -28321,6 +28383,9 @@ sub get_os_release { $base_name = 'RHEL'; $base_version = $version_id if $version_id; } + elsif ($base_type eq 'arch' && $working[1] =~ /$base_type/i){ + $base_name = 'Arch Linux'; + } else { $base_name = ucfirst($working[1]); } @@ -28339,14 +28404,14 @@ sub get_os_release { if (!$base_type){ if ($name && $version_name){ $distro = $name; - $distro = 'Arco Linux' if $lc_name =~ /^arco/; + $distro = 'Arco Linux' if $name_lc =~ /^arco/; if ($version_id && $version_name !~ /$version_id/){ $distro .= ' ' . $version_id; } $distro .= " $version_name"; } - elsif ($pretty_name && ($pretty_name !~ /tumbleweed/i && $lc_name ne 'arcolinux')){ - $distro = $pretty_name; + elsif ($name_pretty && ($name_pretty !~ /tumbleweed/i && $name_lc ne 'arcolinux')){ + $distro = $name_pretty; } elsif ($name){ $distro = $name; @@ -28354,26 +28419,32 @@ sub get_os_release { $distro .= ' ' . $version_id; } } + if ($version_codename && $distro !~ /$version_codename/i){ + $distro .= " $version_codename"; + } } # note: mint has varying formats here, some have ubuntu as name, 17 and earlier else { - # mint 17 used ubuntu os-release, so won't have $base_version + # mint 17 used ubuntu os-release, so won't have $base_version, steamos holo if ($base_name && $base_type eq 'rhel'){ $distro = $base_name; $distro .= ' ' . $version_id if $version_id; } + elsif ($base_name && $base_type eq 'arch'){ + $distro = $base_name; + } elsif ($base_name && $base_version){ $base_id = ubuntu_id($base_version) if $base_type eq 'ubuntu' && $base_version; $base_id = '' if $base_id && "$base_name$base_version" =~ /$base_id/; $base_id .= ' ' if $base_id; $distro = "$base_name $base_id$base_version"; } - elsif ($base_type eq 'default' && ($pretty_name || ($name && $version_name))){ - $distro = ($name && $version_name) ? "$name $version_name" : $pretty_name; + elsif ($base_type eq 'default' && ($name_pretty || ($name && $version_name))){ + $distro = ($name && $version_name) ? "$name $version_name" : $name_pretty; } # LMDE 2 has only limited data in os-release, no _LIKE values. 3 has like and debian_codename - elsif ($base_type eq 'ubuntu' && $lc_name =~ /^(debian|ubuntu)/ && ($pretty_name || ($name && $version_name))){ - $distro = ($name && $version_name) ? "$name $version_name": $pretty_name; + elsif ($base_type eq 'ubuntu' && $name_lc =~ /^(debian|ubuntu)/ && ($name_pretty || ($name && $version_name))){ + $distro = ($name && $version_name) ? "$name $version_name": $name_pretty; } elsif ($base_type eq 'debian' && $base_version){ $distro = debian_id($base_version); @@ -28428,27 +28499,27 @@ sub ubuntu_id { my ($codename) = @_; $codename = lc($codename); my ($id) = (''); + # xx.04, xx.10 my %codenames = ( - 'kinetic' => '22.10', - 'jammy' => '22.04 LTS', - 'impish' => '21.10','hirsute' => '21.04', - 'groovy' => '20.10','focal' => '20.04 LTS', - 'eoan' => '19.10','disco' => '19.04', - 'cosmic' => '18.10','bionic' => '18.04 LTS', - 'artful' => '17.10','zesty' => '17.04', - 'yakkety' => '16.10','xenial' => '16.04 LTS', - 'wily' => '15.10','vivid' => '15.04', - 'utopic' => '14.10','trusty' => '14.04 LTS ', - 'saucy' => '13.10','raring' => '13.04', - 'quantal' => '12.10','precise' => '12.04 LTS ', - # 'oneiric' => '11.10','natty' => '11.04', - # 'maverick' => '10.10','lucid' => '10.04', - # 'karmic' => '9.10','jaunty' => '9.04', - # 'intrepid' => '8.10','hardy' => '8.04', - # 'gutsy' => '7.10','feisty' => '7.04', - # 'edgy' => '6.10', 'dapper' => '6.06', - # 'breezy' => '5.10', 'hoary' => '5.04', - # 'warty' => '4.10', + 'jammy' => '22.04 LTS','kinetic' => '22.10', + 'hirsute' => '21.04','impish' => '21.10', + 'focal' => '20.04 LTS','groovy' => '20.10', + 'disco' => '19.04','eoan' => '19.10', + 'bionic' => '18.04 LTS','cosmic' => '18.10', + 'zesty' => '17.04','artful' => '17.10', + 'xenial' => '16.04 LTS','yakkety' => '16.10', + 'vivid' => '15.04','wily' => '15.10', + 'trusty' => '14.04 LTS ','utopic' => '14.10', + 'raring' => '13.04','saucy' => '13.10', + 'precise' => '12.04 LTS ','quantal' => '12.10', + # 'natty' => '11.04','oneiric' => '11.10', + # 'lucid' => '10.04','maverick' => '10.10', + # 'jaunty' => '9.04','karmic' => '9.10', + # 'hardy' => '8.04','intrepid' => '8.10', + # 'feisty' => '7.04','gutsy' => '7.10', + # 'dapper' => '6.06','edgy' => '6.10', + # 'hoary' => '5.04','breezy' => '5.10', + # 'warty' => '4.10', # warty was the first ubuntu release ); $id = $codenames{$codename} if defined $codenames{$codename}; eval $end if $b_log; @@ -29378,8 +29449,8 @@ sub get_module_version { # called from either -r or -Ix, -r precedes. { package PackageData; -my ($count,%counts,@list,$num,$program,$type); -$counts{'total'} = 0; +my ($count,$num,%pms,$type); +$pms{'total'} = 0; sub get { eval $start if $b_log; # $num passed by reference to maintain incrementing where requested @@ -29395,24 +29466,24 @@ sub get { sub create_output { eval $start if $b_log; my $output = $_[0]; - my $total; - if ($counts{'total'}){ - $total = $counts{'total'}; + my $total = ''; + if ($pms{'total'}){ + $total = $pms{'total'}; } else { - if ($type eq 'inner' || $counts{'note'}){ - $total = 'N/A'; + if ($type eq 'inner' || $pms{'note'}){ + $total = 'N/A' if $extra < 2; } else { $total = main::message('package-data'); } } - if ($counts{'total'} && $extra > 1){ - delete $counts{'total'}; + if ($pms{'total'} && $extra > 1){ + delete $pms{'total'}; my $b_mismatch; - foreach (keys %counts){ + foreach (keys %pms){ next if $_ eq 'note'; - if ($counts{$_}->[0] && $counts{$_}->[0] != $total){ + if ($pms{$_}->{'pkgs'} && $pms{$_}->{'pkgs'} != $total){ $b_mismatch = 1; last; } @@ -29420,22 +29491,32 @@ sub create_output { $total = '' if !$b_mismatch; } $output->{main::key($$num++,1,1,'Packages')} = $total; - # if blocked pm secondary, only show if admin - if ($counts{'note'} && (!$counts{'total'} || $b_admin || $total < 100)){ - $output->{main::key($$num++,0,2,'note')} = $counts{'note'}; + # if blocked pm secondary, only show if no total or improbable total + if ($pms{'note'} && $extra < 2 && (!$pms{'total'} || $total < 100)){ + $output->{main::key($$num++,0,2,'note')} = $pms{'note'}; } - if ($extra > 1 && %counts){ - foreach (sort keys %counts){ + if ($extra > 1 && %pms){ + foreach my $pm (sort keys %pms){ my ($cont,$ind) = (1,2); - # if package mgr command returns error, this will not be an array - next if ref $counts{$_} ne 'ARRAY'; - if ($counts{$_}->[0] || $b_admin){ - my $key = $_; - $key =~ s/^zzz-//; # get rid of the special sorters for items to show last - $output->{main::key($$num++,$cont,$ind,$key)} = $counts{$_}->[0]; - if ($b_admin && $counts{$_}->[1]){ - ($cont,$ind) = (0,3); - $output->{main::key($$num++,$cont,$ind,'lib')} = $counts{$_}->[1]; + # if package mgr command returns error, this will not be a hash + next if ref $pms{$pm} ne 'HASH'; + if ($pms{$pm}->{'pkgs'} || $b_admin || ($extra > 1 && $pms{$pm}->{'note'})){ + my $type = $pm; + $type =~ s/^zzz-//; # get rid of the special sorters for items to show last + $output->{main::key($$num++,$cont,$ind,'pm')} = $type; + ($cont,$ind) = (0,3); + $pms{$pm}->{'pkgs'} = 'N/A' if $pms{$pm}->{'note'}; + $output->{main::key($$num++,($cont+1),$ind,'pkgs')} = $pms{$pm}->{'pkgs'}; + if ($pms{$pm}->{'note'}){ + $output->{main::key($$num++,$cont,$ind,'note')} = $pms{$pm}->{'note'}; + } + if ($b_admin ){ + if ($pms{$pm}->{'libs'}){ + $output->{main::key($$num++,$cont,($ind+1),'libs')} = $pms{$pm}->{'libs'}; + } + if ($pms{$pm}->{'tools'}){ + $output->{main::key($$num++,$cont,$ind,'tools')} = $pms{$pm}->{'tools'}; + } } } } @@ -29446,17 +29527,23 @@ sub create_output { sub package_counts { eval $start if $b_log; my ($type) = @_; + # note: there is a program called discover which has nothing to do with kde + # apt systems: plasma-discover, non apt, discover, but can't use due to conflict + # my $disc = 'plasma-discover'; + my $gs = 'gnome-software'; # 0: key; 1: program; 2: p/d; 3: arg/path; 4: 0/1 use lib; - # 5: lib slice; 6: lib splitter; 7 - optional eval test + # 5: lib slice; 6: lib splitter; 7 - optional eval test; + # 8: optional installed tool tests for -ra # needed: cards [nutyx], urpmq [mageia] my @pkg_managers = ( ['alps','alps','p','showinstalled',1,0,''], ['apk','apk','p','info',1,0,''], - # older dpkg-query do not support -f values consistently: eg ${binary:Package} - ['apt','dpkg-query','p','-W -f=\'${Package}\n\'',1,0,''], # ['aptd','dpkg-query','d','/usr/lib/*',1,3,'\\/'], # mutyx. do cards test because there is a very slow pkginfo python pkg mgr ['cards','pkginfo','p','-i',1,1,'','main::check_program(\'cards\')'], + # older dpkg-query do not support -f values consistently: eg ${binary:Package} + ['dpkg','dpkg-query','p','-W -f=\'${Package}\n\'',1,0,'','', + ['apt','apt-get','aptitude','synaptic']], ['emerge','emerge','d','/var/db/pkg/*/*/',1,5,'\\/'], ['eopkg','eopkg','d','/var/lib/eopkg/package/*',1,5,'\\/'], ['guix-sys','guix','p','package -p "/run/current-system/profile" -I',1,0,''], @@ -29466,30 +29553,38 @@ sub package_counts { ['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,'-'], + ['opkg','opkg','p','list',1,0,''], # ubuntu based Security Onion ['pacman','pacman','p','-Qq --color never',1,0,'', - '!main::check_program(\'pacman-g2\')'], # pacman-g2 has sym link to pacman - ['pacman-g2','pacman-g2','p','-Q',1,0,''], + '!main::check_program(\'pacman-g2\')', # pacman-g2 has sym link to pacman + # these may need to be trimmed down depending on how useful/less some are + ['argon','aura','aurutils','cylon','octopi','pacaur','pakku','pamac','paru', + 'pikaur','trizen','yaourt','yay','yup']], + ['pacman-g2','pacman-g2','p','-Q',1,0,'','',], ['pkg','pkg','d','/var/db/pkg/*',1,0,''], # 'pkg list' returns non programs ['pkg_info','pkg_info','p','',1,0,''], # like cards, avoid pkginfo directly due to python pm being so slow # but pkgadd is also found in scratch ['pkgutils','pkginfo','p','-i',1,0,'','main::check_program(\'pkgadd\')'], # slack 15 moves packages to /var/lib/pkgtools/packages but links to /var/log/packages - ['pkgtool','pkgtool','d','/var/lib/pkgtools/packages',1,4,'\\/', - '-d \'/var/lib/pkgtools/packages\''], - ['pkgtool','pkgtool','d','/var/log/packages/',1,5,'\\/', - '! -d \'/var/lib/pkgtools/packages\' && -d \'/var/log/packages/\''], + ['pkgtool','installpkg','d','/var/lib/pkgtools/packages/*',1,5,'\\/', + '-d \'/var/lib/pkgtools/packages\'', + ['slackpkg','slapt-get','slpkg','swaret']], + ['pkgtool','installpkg','d','/var/log/packages/*',1,4,'\\/', + '! -d \'/var/lib/pkgtools/packages\' && -d \'/var/log/packages/\'', + ['slackpkg','slapt-get','slpkg','swaret']], # rpm way too slow without nodigest/sig!! confirms packages exist # but even with, MASSIVELY slow in some cases, > 20, 30 seconds!!!! # find another way to get rpm package counts or don't show this feature for rpm!! - ['rpm','rpm','pkg','-qa --nodigest --nosignature',1,0,''], + ['rpm','rpm','force','-qa --nodigest --nosignature',1,0,'','', + ['dnf','packagekit','up2date','urpmi','yast','yum','zypper']], # scratch is a programming language too, with software called scratch ['scratch','pkgbuild','d','/var/lib/scratchpkg/index/*/.pkginfo',1,5,'\\/', '-d \'/var/lib/scratchpkg\''], - # note',' slapt-get, spkg, and pkgtool all return the same count + # note: slackpkg, slapt-get, spkg, and pkgtool all return the same count + # ['slackpkg','pkgtool','slapt-get','slpkg','swaret']], # ['slapt-get','slapt-get','p','--installed',1,0,''], # ['spkg','spkg','p','--installed',1,0,''], - ['tce','tce-status','p','-i',1,0,''], + ['tce','tce-status','p','-i',1,0,'','',['apps','tce-load']], # note: I believe mageia uses rpm internally but confirm # ['urpmi','urpmq','p','??',1,0,''], ['xbps','xbps-query','p','-l',1,1,''], @@ -29497,47 +29592,88 @@ sub package_counts { ['zzz-flatpak','flatpak','p','list',0,0,''], ['zzz-snap','snap','p','list',0,0,'','@ps_cmd && (grep {/\bsnapd\b/} @ps_cmd)'], ); - my $libs; - foreach (@pkg_managers){ - if ($program = main::check_program($_->[1])){ - next if $_->[7] && !eval $_->[7]; - my $error; - if ($_->[2] eq 'p' || ($_->[2] eq 'pkg' && $force{'pkg'})){ - chomp(@list = qx($program $_->[3] 2>/dev/null)); + my ($program); + foreach my $pm (@pkg_managers){ + if ($program = main::check_program($pm->[1])){ + next if $pm->[7] && !eval $pm->[7]; + my ($error,$libs,@list,$pmts); + if ($pm->[2] eq 'p' || ($pm->[2] eq 'force' && check_run($pm))){ + chomp(@list = qx($program $pm->[3] 2>/dev/null)); } - elsif ($_->[2] eq 'd'){ - @list = main::globber($_->[3]); + elsif ($pm->[2] eq 'd'){ + @list = main::globber($pm->[3]); } else { - undef @list; - $error = main::message('pm-disabled'); + # update message() if pm other than rpm disabled by default + $error = main::message('pm-' . $pm->[1] . '-disabled'); } - undef $libs; + $count = scalar @list if !$error; # print Data::Dumper::Dumper \@list; if (!$error){ - $count = scalar @list; - if ($b_admin && $count && $_->[4]){ - $libs = count_libs(\@list,$_->[5],$_->[6]); + if ($b_admin && $count && $pm->[4]){ + $libs = count_libs(\@list,$pm->[5],$pm->[6]); } - $counts{$_->[0]} = [$count,$libs]; - $counts{'total'} += $count; } else { - $counts{'note'} = $error; + $pms{'note'} = $error; + } + # if there is ambiguity about actual program installed, use this loop + if ($b_admin && $pm->[8]){ + my @tools; + foreach my $tool (@{$pm->[8]}){ + if (main::check_program($tool)){ + push(@tools,$tool); + } + } + # only show gs if tools found, and if not added before + if (@tools){ + if ($gs && main::check_program($gs)){ + push(@tools,$gs); + $gs = ''; + } + } + $pmts = join(',',sort @tools) if @tools; } - # print Data::Dumper::Dumper \%counts; + $pms{$pm->[0]} = { + 'pkgs' => $count, + 'libs' => $libs, + 'note' => $error, + 'tools' => $pmts, + }; + $pms{'total'} += $count if defined $count; + # print Data::Dumper::Dumper \%pms; } } - # print Data::Dumper::Dumper \%counts; - main::log_data('dump','Package managers: %counts',\%counts) if $b_log; + # print Data::Dumper::Dumper \%pms; + main::log_data('dump','Package managers: %pms',\%pms) if $b_log; eval $end if $b_log; } sub appimage_counts { if (@ps_cmd && (grep {/\bappimaged\b/} @ps_cmd)){ - @list = main::globber($ENV{'HOME'} . '/.local/bin/*.appimage'); + my @list = main::globber($ENV{'HOME'} . '/.local/bin/*.appimage'); $count = scalar @list; - $counts{'zzz-appimage'} = [$count,undef] if $count; - $counts{'total'} += $count; + $pms{'zzz-appimage'} = { + 'pkgs' => $count, + 'libs' => undef, + }; + $pms{'total'} += $count; + } +} +sub check_run { + if ($force{'pkg'}){ + return 1; + } + elsif (${_[0]}->[1] eq 'rpm'){ + # testing for core wrappers for rpm, these should not be present in non + # redhat/suse based systems. mageia has urpmi, dnf, yum + foreach my $tool (('dnf','up2date','urpmi','yum','zypper')){ + return 0 if main::check_program($tool); + } + # Note: test fails: apt-rpm (pclinuxos,alt linux), unknown how to detect + # Add pm test if known to have rpm available. + foreach my $tool (('dpkg','pacman','pkgtool','tce-load')){ + return 1 if main::check_program($tool); + } } } sub count_libs { @@ -30428,11 +30564,12 @@ sub set_ps_gui { tdelauncher tdeinit_phase1); push(@match,@temp); @temp=qw(2bwm 3dwm 9wm afterstep aewm aewm\+\+ amiwm antiwm awesome - blackbox bspwm calmwm catwm (sh|c?lisp).*clfswm ctwm (openbsd-)?cwm dwm evilwm + blackbox bspwm calmwm catwm cde (sh|c?lisp).*clfswm ctwm (openbsd-)?cwm + dwm evilwm fluxbox flwm flwm_topside fvwm.*-crystal fvwm1 fvwm2 fvwm3 fvwm95 fvwm herbstluftwm i3 icewm instantwm ion3 jbwm jwm larswm leftwm lwm matchbox-window-manager mcwm mini monsterwm musca mwm nawm notion - openbox pekwm penrose python.*qtile qvwm ratpoison + openbox nscde pekwm penrose python.*qtile qvwm ratpoison sawfish scrotwm snapwm spectrwm (sh|c?lisp).*stumpwm tinywm tvtwm twm uwm windowlab WindowMaker wingo wm2 wmfs wmfs2 wmii2 wmii wmx xfdesktop xmonad yeahwm); |
