diff options
author | Unit 193 <unit193@unit193.net> | 2024-02-08 03:08:28 -0500 |
---|---|---|
committer | Unit 193 <unit193@unit193.net> | 2024-02-08 03:08:28 -0500 |
commit | bfd00ee5282d7f8f9c4d81d37fbba99aa582fd70 (patch) | |
tree | 569dbf6e8f9cddfb60f75f6e1306afcd2d5d31d0 | |
parent | e09bcc3824ae2b8891f00085157f49e0f2245e6e (diff) | |
download | inxi-upstream.tar.bz2 inxi-upstream.tar.xz inxi-upstream.tar.zst |
New upstream version 3.3.33-1.upstream/3.3.33-1upstream
-rwxr-xr-x | inxi | 1052 | ||||
-rw-r--r-- | inxi.1 | 83 | ||||
-rw-r--r-- | inxi.changelog | 161 |
3 files changed, 829 insertions, 467 deletions
@@ -49,8 +49,8 @@ use POSIX qw(ceil uname strftime ttyname); ## INXI INFO ## my $self_name='inxi'; -my $self_version='3.3.32'; -my $self_date='2024-01-30'; +my $self_version='3.3.33'; +my $self_date='2024-02-06'; my $self_patch='00'; ## END INXI INFO ## @@ -73,10 +73,9 @@ if (eval {require OpenBSD::Pledge}){ my ($fake_data_dir,$self_path,$user_config_dir,$user_config_file,$user_data_dir); ## Hashes -my (%alerts,%build_prop,%client,%colors,,%cpuinfo_machine,%comps, -%disks_bsd,%dboot,%devices,%dl,%dmmapper,%force,%loaded,%mapper, -%program_values,%ps_data,%risc,%service_tool,%show,%sysctl,%system_files, -%usb,%windows); +my (%alerts,%build_prop,%client,%colors,,%cpuinfo_machine,%comps,%disks_bsd, +%dboot,%devices,%dl,%dmmapper,%force,%loaded,%mapper,%program_values,%ps_data, +%risc,%service_tool,%show,%sysctl,%system_files,%usb,%windows); ## System Arrays my (@cpuinfo,@dmi,@ifs,@ifs_bsd,@paths,@ps_aux,@ps_cmd, @@ -121,7 +120,6 @@ my ($display_opt,$sudoas) = ('',''); ## Output my $extra = 0;# supported values: 0-3 my $filter_string = '<filter>'; -my $join_sep_max = 30; # max join length of array+separator, used in set_join_sep my $line1 = "----------------------------------------------------------------------\n"; my $line2 = "======================================================================\n"; my $line3 = "----------------------------------------\n"; @@ -148,6 +146,7 @@ my %size = ( 'irc' => 100, # shorter because IRC clients have nick lists etc 'lines' => 1, # for active output line counter for -Y 'max-cols' => 0, +'max-join-list' => 30, # used in make_list_value() to add space after sep or not. 'max-lines' => 0, 'max-wrap' => 110, 'no-display' => 100, # No Display, orig: 130 @@ -2217,6 +2216,8 @@ sub system_data { ['systemctl','list-units'], ['systemctl','list-units --type=target'], ['systemd-detect-virt',''], + ['tlp-stat',''], # no arg outputs all data + ['tlp-stat','-s'], ['udevadm','info -e'], ['udevadm','info -p /devices/virtual/dmi/id'], ['udevadm','--version'], @@ -2662,6 +2663,36 @@ sub upload_file { } } +# see docs/optimization.txt +sub ram_use { + my ($name, $ref) = @_; + printf "%-25s %5d %5d\n", $name, size($ref), total_size($ref); +} + +# Used to create user visible debuugging output for complicated scenarios +# args: 0: $type; 1: data (scalar or array/hash ref); 2: 0/1 dbg item; +sub feature_debugger { + my ($type,$data,$b_switch) = @_; + my @result; + push(@result,'sub: ' . (caller(1))[3],'type: ' . $type); + if (ref $data eq 'ARRAY' || ref $data eq 'HASH'){ + $data = Data::Dumper::Dumper $data; + } + else { + $data .= "\n" if !$b_log; + } + push(@result,'data: ' . $data); + # note, if --debug 3 and eg. --dbg 63 used, we want this to print out + if (!$b_log || ($b_switch && $debugger{'level'} < 10)){ + unshift(@result,'------------------'); + push(@result,"------------------\n") if $b_log; + print join("\n",@result); + } + else { + main::log_data('dump','feature dbg @result',\@result); + } +} + # random tests for various issues sub user_debug_test_1 { # open(my $duped, '>&', STDOUT); @@ -2677,12 +2708,6 @@ sub user_debug_test_1 { # close $duped; } -# see docs/optimization.txt -sub ram_use { - my ($name, $ref) = @_; - printf "%-25s %5d %5d\n", $name, size($ref), total_size($ref); -} - #### ------------------------------------------------------------------- #### DOWNLOADER #### ------------------------------------------------------------------- @@ -2891,6 +2916,8 @@ sub error_handler { $errno=10; $b_help=1; "Unsupported value: $two for option: $one" } elsif ($err eq 'bad-arg-int'){ $errno=11; "Bad internal argument: $one" } + elsif ($err eq 'arg-modifier'){ + $errno=10; $b_help=1; "Missing option: $one must be used with: $two" } elsif ($err eq 'distro-block'){ $errno=20; "Option: $one has been disabled by the $self_name distribution maintainer." } elsif ($err eq 'option-feature-incomplete'){ @@ -4339,8 +4366,8 @@ sub set_version_data { ## OptionsHandler { package OptionsHandler; -# note: had %trigger local but tripped odd perl 5.008 failures unless global -# so moved to %use and %show globals. +# Note: used %trigger here, but perl 5.008 had issues, so mmoved to global. +# Careful with hash globals in first Perl 5.0080. my ($self_download,$download_id); sub get { @@ -4439,6 +4466,15 @@ sub get { $show{'network'} = 1; $show{'network-advanced'} = 1; $use{'downloader'} = 1 if !main::check_program('dig');}, + 'ip-limit|limit:i' => sub { + my ($opt,$arg) = @_; + if ($arg != 0){ + $limit = $arg; + $use{'ip-limit'} = 1; + } + else { + main::error_handler('bad-arg',$opt,$arg); + }}, 'I|info' => sub { $show{'short'} = 0; $show{'info'} = 1;}, @@ -4450,14 +4486,6 @@ sub get { $show{'usb'} = 1;}, 'l|labels|label' => sub { $show{'label'} = 1;}, - 'limit:i' => sub { - my ($opt,$arg) = @_; - if ($arg != 0){ - $limit = $arg; - } - else { - main::error_handler('bad-arg',$opt,$arg); - }}, 'L|logical|lvm' => sub { $show{'short'} = 0; $show{'logical'} = 1;}, @@ -4489,17 +4517,18 @@ sub get { $show{'short'} = 0; $show{'partition'} = 0; $show{'partition-full'} = 1;}, - 'P|partitions|partition' => sub { - $show{'short'} = 0; - $show{'partition'} = 1;}, - 'partition-sort:s' => sub { + 'partition-sort|partitions-sort|ps:s' => sub { my ($opt,$arg) = @_; if ($arg =~ /^(dev-base|fs|id|label|percent-used|size|uuid|used)$/){ $show{'partition-sort'} = $arg; + $use{'partition-sort'} = 1; } else { main::error_handler('bad-arg',$opt,$arg); }}, + 'P|partition|partitions' => sub { + $show{'short'} = 0; + $show{'partition'} = 1;}, 'r|repos|repo' => sub { $show{'short'} = 0; $show{'repo'} = 1;}, @@ -4510,6 +4539,26 @@ sub get { 's|sensors|sensor' => sub { $show{'short'} = 0; $show{'sensor'} = 1;}, + 'sensors-default' => sub { + $use{'sensors-default'} = 1;}, + 'sensors-exclude:s' => sub { + my ($opt,$arg) = @_; + if ($arg){ + @sensors_exclude = split(/\s*,\s*/, $arg); + $use{'sensors-exclude'} = 1; + } + else { + main::error_handler('bad-arg',$opt,$arg); + }}, + 'sensors-use:s' => sub { + my ($opt,$arg) = @_; + if ($arg){ + @sensors_use = split(/\s*,\s*/, $arg); + $use{'sensors-use'} = 1; + } + else { + main::error_handler('bad-arg',$opt,$arg); + }}, 'separator|sep:s' => sub { my ($opt,$arg) = @_; if ($arg){ @@ -4526,6 +4575,7 @@ sub get { $arg ||= 0; if ($arg >= 0){ $cpu_sleep = $arg; + $use{'cpu-sleep'} = 1; } else { main::error_handler('bad-arg',$opt,$arg); @@ -4665,6 +4715,7 @@ sub get { # future proofs this if ($arg =~ /^[1-9]$/){ $weather_source = $arg; + $use{'weather-source'} = 1; } else { main::error_handler('bad-arg',$opt,$arg); @@ -4678,6 +4729,7 @@ sub get { my %units = ('c'=>'m','f'=>'i','cf'=>'mi','fc'=>'im'); $arg = $units{$arg} if defined $units{$arg}; $weather_unit = $arg; + $use{'weather-unit'} = 1; } else { main::error_handler('bad-arg',$opt,$arg); @@ -5059,26 +5111,8 @@ sub get { undef %risc; $risc{'id'} = 'riscv'; $risc{'riscv'} = 1;}, - 'sensors-default' => sub { - $use{'sensors-default'} = 1;}, - 'sensors-exclude:s' => sub { - my ($opt,$arg) = @_; - if ($arg){ - @sensors_exclude = split(/\s*,\s*/, $arg); - } - else { - main::error_handler('bad-arg',$opt,$arg); - }}, 'sensors-sys' => sub { $force{'sensors-sys'} = 1;}, - 'sensors-use:s' => sub { - my ($opt,$arg) = @_; - if ($arg){ - @sensors_use = split(/\s*,\s*/, $arg); - } - else { - main::error_handler('bad-arg',$opt,$arg); - }}, 'sparc' => sub { undef %risc; $risc{'id'} = 'sparc'; @@ -5114,11 +5148,50 @@ sub get { main::error_handler('unknown-option', "$opt", "");} ); # or error_handler('unknown-option', "@ARGV", ''); # run all these after so that we can change widths, downloaders, etc - # print Data::Dumper::Dumper \%trigger; post_process(); eval $end if $b_log; } +# These options require other option[s] to function, and have no meaning alone. +sub check_modifiers { + if ($use{'cpu-sleep'} && !$show{'cpu'} && !$show{'cpu-basic'} && + !$show{'short'}){ + main::error_handler('arg-modifier', '--sleep', '[no-options], -b, -C, -v [>0]'); + } + if ($show{'label'} && !$show{'partition'} && !$show{'partition-full'} && + !$show{'swap'} && !$show{'unmounted'}){ + main::error_handler('arg-modifier', '-l/--label', '-j, -o, -p, -P'); + } + if ($use{'ip-limit'} && !$show{'ip'}){ + main::error_handler('arg-modifier', '--limit', '-i'); + } + if ($output_type && $output_type ne 'screen' && !$output_file){ + main::error_handler('arg-modifier', '--output', '--output-file [filename]'); + } + if ($use{'partition-sort'} && !$show{'partition'} && !$show{'partition-full'}){ + main::error_handler('arg-modifier', '--partition-sort', '-p, -P'); + } + if ($use{'sensors-default'} && !$show{'sensor'}){ + main::error_handler('arg-modifier', '--sensors-default', '-s'); + } + if ($use{'sensors-exclude'} && !$show{'sensor'}){ + main::error_handler('arg-modifier', '--sensors-exclude', '-s'); + } + if ($use{'sensors-use'} && !$show{'sensor'}){ + main::error_handler('arg-modifier', '--sensors-use', '-s'); + } + if ($show{'uuid'} && !$show{'machine'} && !$show{'partition'} && + !$show{'partition-full'} && !$show{'swap'} && !$show{'unmounted'}){ + main::error_handler('arg-modifier', '-u/--uuid', '-j, -M, -o, -p, -P'); + } + if ($use{'weather-source'} && !$show{'weather'}){ + main::error_handler('arg-modifier', '--weather-source/--ws', '-w'); + } + if ($use{'weather-unit'} && !$show{'weather'}){ + main::error_handler('arg-modifier', '--weather-unit/--wu', '-w'); + } +} + sub post_process { # first run all the stuff that exits after running CheckRecommends::run() if $show{'recommends'}; @@ -5132,35 +5205,9 @@ sub post_process { $use{'man'} = 0 if (!$use{'yes-man'} || $use{'no-man'}); main::update_me($self_download,$download_id) if $use{'update-trigger'}; main::set_xorg_log() if $show{'graphic'}; - if ($b_pledge){ - my $b_update; - # if -c 9x, remove in SelectColors::set_selection(), else remove here - if (!$colors{'selector'} && $debugger{'level'} < 21){ - @pledges = grep {$_ ne 'getpw'} @pledges; - $b_update = 1; - } - if ($debugger{'level'} < 21){ # remove ftp upload - @pledges = grep {!/(dns|inet)/} @pledges; - $b_update = 1; - } - # not writing/creating .inxi data dirs colors selector launches set_color() - if (!$show{'weather'} && !$colors{'selector'} && $debugger{'level'} < 10 && - $output_type eq 'screen'){ - @pledges = grep {!/(cpath|wpath)/} @pledges; - $b_update = 1; - } - OpenBSD::Pledge::pledge(@pledges) if $b_update; - } - if ($output_type){ - if ($output_type ne 'screen' && !$output_file){ - main::error_handler('bad-arg', '--output', '--output-file not provided'); - } - } - if (($show{'label'} || $show{'uuid'}) && !$show{'partition'} && - !$show{'partition-full'} && !$show{'swap'} && !$show{'unmounted'}){ - main::error_handler('bad-arg', '-l/-u', 'missing required option(s) -j, -o, -p, -P'); - } - $extra = 3 if $b_admin; + set_pledge() if $b_pledge; + $extra = 3 if $b_admin; # before check_modifiers in case we make $estra based. + check_modifiers(); # this turns off basic for F/v graphic output levels. if ($show{'graphic-basic'} && $show{'graphic-full'} && $extra > 1){ $show{'graphic-basic'} = 0; @@ -5306,6 +5353,26 @@ sub process_updater { main::error_handler('distro-block', $opt); } } + +sub set_pledge { + my $b_update; + # if -c 9x, remove in SelectColors::set_selection(), else remove here + if (!$colors{'selector'} && $debugger{'level'} < 21){ + @pledges = grep {$_ ne 'getpw'} @pledges; + $b_update = 1; + } + if ($debugger{'level'} < 21){ # remove ftp upload + @pledges = grep {!/(dns|inet)/} @pledges; + $b_update = 1; + } + # not writing/creating .inxi data dirs colors selector launches set_color() + if (!$show{'weather'} && !$colors{'selector'} && $debugger{'level'} < 10 && + $output_type eq 'screen'){ + @pledges = grep {!/(cpath|wpath)/} @pledges; + $b_update = 1; + } + OpenBSD::Pledge::pledge(@pledges) if $b_update; +} } sub show_options { @@ -5368,6 +5435,8 @@ sub show_options { ['1', '-i', '--ip', "WAN IP address and local interfaces (requires ifconfig or ip network tool). Triggers -n. Not shown with -F for user security reasons. You shouldn't paste your local/WAN IP."], + ['1', '', '--ip-limit, --limit', "[-1; 1-x] Set max output limit of IP + addresses for -i (default 10; -1 removes limit)."], ['1', '-I', '--info', "General info, including processes, uptime, memory (if -m/-tm not used), IRC client or shell type, $self_name version."], ['1', '-j', '--swap', "Swap in use. Includes ${partition_string}s, zram, @@ -5398,6 +5467,9 @@ sub show_options { ['1', '', '', "Example: ^<username>^ALL^=^NOPASSWD:^/usr/bin/file^"], ['1', '-p', '--partitions-full', "Full $partition_string information (-P plus all other detected ${partition_string}s)."], + ['1', '', '--partitions-sort, --ps', " + [dev-base|fs|id|label|percent-used|size|uuid|used] Change sort order of + ${partition_string} output. See man page for specifics."], ['1', '-P', '--partitions', "Basic $partition_string info. Shows, if detected: / /boot /home /opt /tmp /usr /usr/home /var /var/log /var/tmp. Swap ${partition_string}s show if --swap is not used. Use -p to see all @@ -5420,7 +5492,8 @@ sub show_options { of processes for each type (default: 5; if in IRC, max: 5). "], ['1', '', '', "Make sure that there is no space between letters and numbers (e.g.^-t^cm10)."], - ['1', '-u', '--uuid', "$partition_string_u UUIDs. Use with -j, -o, -p, -P."], + ['1', '-u', '--uuid', "$partition_string_u, system board UUIDs. Use with -j, + -M, -o, -p, -P."], ['1', '-v', '--verbosity', "Set $self_name verbosity level (0-8). Should not be used with -b or -F. Example: $self_name^-v^4"], ['2', '0', '', "Same as: $self_name"], @@ -5498,16 +5571,12 @@ sub show_options { width."], ['1', '', '--indents', "[0-10] Change wrapped mode primary indentation width, and secondary / -y1 indent widths."], - ['1', '', '--limit', "[-1; 1-x] Set max output limit of IP addresses for -i - (default 10; -1 removes limit)."], ['1', '', '--max-wrap,--wrap-max', "[70-xxx] Set maximum width where $self_name autowraps line starters. Current: $size{'max-wrap'}"], ['1', '', '--output', "[json|screen|xml] Change data output type. Requires --output-file if not screen."], ['1', '', '--output-file', "[Full filepath|print] Output file to be used for --output."], - ['1', '', '--partition-sort', "[dev-base|fs|id|label|percent-used|size|uuid|used] - Change sort order of ${partition_string} output. See man page for specifics."], ['1', '', '--separator, --sep', "[key:value separator character]. Change separator character(s) for key: value pairs."], ['1', '-y', '--width', "[empty|-1|1|60-xxx] Output line width max. Overrides @@ -5696,7 +5765,7 @@ sub show_options { available); APIs: OpenGL: device memory, unified memory status; Vulkan: adds full device report, device name, driver version, surfaces."], ['2', '-I', '', "Adds to Power suspend/hibernate available non active states, - hibernate image size, suspend failed totals (if not 0), active power daemons; + hibernate image size, suspend failed totals (if not 0), active power services; 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 @@ -5708,7 +5777,8 @@ sub show_options { full device/components report (speed, mapped names)."], ['2', '-m', '', "Show full volts report, current, min, max, even if identical; show firmware version (if available)."], - ['2', '-n,-N', '', "If available: list of alternate kernel modules/drivers + ['2', '-n,-i', '', "Info: services: line, with running network services."], + ['2', '-n,-N,-i', '', "If available: list of alternate kernel modules/drivers for device(s); PCIe lanes-max: gen, speed, lanes (if relevant); USB mode (if found)."], ['2', '-o', '', "If available: maj:min of device."], @@ -6520,6 +6590,26 @@ sub make_line { return $line; } +# Takes an array ref, creates value ref, comma separated, with ','/', ' +# depending on assigned max list value length. +# args: 0: array ref; 1: value result ref; 2: [separator]; 3: [sort]; +# 4: [N/A value, if missing, return undef] +sub make_list_value { + my $sep = $_[2]; + $sep ||= ','; + if (!defined $_[0] || !@{$_[0]}){ + ${$_[1]} = $_[4] if $_[4]; + return; + } + # note: printer only wraps if value 'word' count > 2, and trick with quoting + # array includes 1 white space between values + if (scalar @{$_[0]} > 2 && length("@{$_[0]}") > $size{'max-join-list'}){ + $sep .= ' '; + } + @{$_[0]} = sort {"\L$a" cmp "\L$b"} @{$_[0]} if $_[3] && $_[3] eq 'sort'; + ${$_[1]} = join($sep,@{$_[0]}); +} + # args: 0: type; 1: info [optional]; 2: info [optional] sub message { my ($type,$id,$id2) = @_; @@ -6586,6 +6676,7 @@ sub message { 'monitor-id' => 'not-matched', 'monitor-na' => 'N/A', 'monitor-wayland' => 'no compositor data', + 'network-services' => 'No services found.', 'note-check' => 'check', 'note-est' => 'est.', 'note-not-reliable' => 'not reliable', @@ -6701,13 +6792,6 @@ sub remove_duplicates { return $string; } -# args: 0: array ref; 1: separator by ref -sub set_join_sep { - # note: printer only wraps if value 'word' count > 2, so make this match - return if !defined $_[0] || !@{$_[0]} || scalar @{$_[0]} < 3; - ${$_[1]} = ${$_[1]} . ' ' if length(join(${$_[1]},@{$_[0]})) > $join_sep_max; -} - # args: 0: string to turn to KiB integer value. # Convert string passed to KB, based on GB/MB/TB id # NOTE: 1 [K 1000; kB: 1000; KB 1024; KiB 1024] bytes @@ -18801,7 +18885,7 @@ sub map_monitor_ids { # obviously, if one of the matches was wrong, this will also be wrong, but # thats' life when dealing with irrational data. DP is a particular problem. if (scalar @unmatched_sys == 1){ - $monitor_map->{$unmatched_display[0]} = $unmatched_sys[0]->[0]; + $monitor_map->{$unmatched_display[0]} = $unmatched_sys[0]; } main::log_data('dump','$monitor_map ref',$monitor_map) if $b_log; print Data::Dumper::Dumper $monitor_map if $dbg[45]; @@ -19474,7 +19558,8 @@ sub machine_output { if ($extra > 1 && $data->{'product_sku'}){ $rows->[$j]{main::key($num++,0,3,'part-nu')} = $data->{'product_sku'}; } - if ($extra > 2 && ($data->{'product_uuid'} || $data->{'board_uuid'})){ + if (($show{'uuid'} || $extra > 2) && + ($data->{'product_uuid'} || $data->{'board_uuid'})){ my $uuid = ($data->{'product_uuid'}) ? $data->{'product_uuid'} : $data->{'board_uuid'}; $uuid = main::filter($uuid,'filter-uuid'); $rows->[$j]{main::key($num++,0,3,'uuid')} = $uuid; @@ -20232,6 +20317,9 @@ sub get { else { advanced_data_bsd($rows,'check'); } + if ($b_admin){ + info_data($rows); + } } if ($show{'ip'}){ wan_ip($rows); @@ -20657,6 +20745,28 @@ sub if_ip { eval $end if $b_log; } +sub info_data { + eval $start if $b_log; + my ($rows) = @_; + my $j = scalar @$rows; + my $num = 0; + my $services; + PsData::set_cmd() if !$loaded{'ps-cmd'}; + PsData::set_network(); + if (@{$ps_data{'network-services'}}){ + main::make_list_value($ps_data{'network-services'},\$services,',','sort'); + } + else { + $services = main::message('network-services'); + } + + push(@$rows,{ + main::key($num++,1,1,'Info') => '', + main::key($num++,0,2,'services') => $services, + }); + eval $end if $b_log; +} + # Get ip using downloader to stdout. This is a clean, text only IP output url, # single line only, ending in the ip address. May have to modify this in the future # to handle ipv4 and ipv6 addresses but should not be necessary. @@ -29355,10 +29465,8 @@ sub de_enlightenment_based_data { ($desktop->[2],$desktop->[3]) = ProgramData::full('efl-version',$program); } $desktop->[2] ||= 'EFL' if $extra > 1; - if ($b_dbg_de){ - de_wm_debugger('de ' . $desktop->[0] . ' v_src,program,desktop', - [$v_src,$program,$desktop]); - } + main::feature_debugger('de ' . $desktop->[0] . ' v_src,program,desktop', + [$v_src,$program,$desktop],$dbg[63]) if $b_dbg_de; } eval $end if $b_log; } @@ -29380,7 +29488,7 @@ sub de_gnome_based_data { ($desktop->[0],$desktop->[1]) = ProgramData::full('cinnamon','cinnamon',0); $tk_test = 'gtk'; $desktop->[0] ||= 'Cinnamon'; - de_wm_debugger('gnome test 1 $desktop',$desktop) if $b_dbg_de; + main::feature_debugger('gnome test 1 $desktop',$desktop,$dbg[63]) if $b_dbg_de; } elsif ($xdg_desktop eq 'mate' || $gdmsession eq 'mate' || $xprop{'marco'}){ # NOTE: mate-about and mate-sesssion vary which has the higher number, neither @@ -29395,7 +29503,7 @@ sub de_gnome_based_data { $desktop->[1] = main::compare_versions($versions{'mate-about'},$versions{'mate-session'}); # $tk_test = 'gtk'; $desktop->[0] ||= 'MATE'; - de_wm_debugger('gnome test 2 $desktop',$desktop) if $b_dbg_de; + main::feature_debugger('gnome test 2 $desktop',$desktop,$dbg[63]) if $b_dbg_de; } # See sub for logic and comments elsif (check_gnome()){ @@ -29407,7 +29515,8 @@ sub de_gnome_based_data { } $tk_test = 'gtk'; $desktop->[0] ||= 'GNOME'; - de_wm_debugger('gnome test 3 $desktop $desktop',$desktop) if $b_dbg_de; + main::feature_debugger('gnome test 3 $desktop $desktop',$desktop, + $dbg[63]) if $b_dbg_de; } eval $end if $b_log; } @@ -29453,7 +29562,7 @@ sub check_gnome { $b_gnome = 1; } if ($b_dbg_de && $b_gnome){ - de_wm_debugger('gnome $detection','detect-type: ' . $detection); + main::feature_debugger('gnome $detection','detect-type: ' . $detection,$dbg[63]); } main::log_data('data','$detection:$b_gnome>>' . $detection . ":$b_gnome") if $b_log; eval $end if $b_log; @@ -29485,10 +29594,8 @@ sub de_kde_tde_data { } $desktop->[0] ||= 'Trinity'; $desktop->[2] ||= 'Qt' if $extra > 1; - if ($b_dbg_de){ - de_wm_debugger('kde trinity $program,$v_data,$desktop', - [$program,$v_data,$desktop]); - } + main::feature_debugger('kde trinity $program,$v_data,$desktop', + [$program,$v_data,$desktop],$dbg[63]) if $b_dbg_de; } # works on 4, assume 5 will id the same, why not, no need to update in future # KDE_SESSION_VERSION is the integer version of the desktop @@ -29506,10 +29613,8 @@ sub de_kde_tde_data { } $desktop->[0] ||= 'KDE'; $desktop->[2] ||= 'Qt' if $extra > 1; - if ($b_dbg_de){ - de_wm_debugger('kde 4 program,v_data,$desktop', - [$program,$v_data,$desktop]); - } + main::feature_debugger('kde 4 program,v_data,$desktop', + [$program,$v_data,$desktop],$dbg[63]) if $b_dbg_de; } # KDE >= 5 else { @@ -29561,10 +29666,8 @@ sub de_kde_tde_data { } } } - if ($b_dbg_de){ - de_wm_debugger('kde >= 5 v_src,tk_src,fw_src,v_data,$desktop', - [$v_src,$tk_src,$fw_src,$v_data,$desktop]); - } + main::feature_debugger('kde >= 5 v_src,tk_src,fw_src,v_data,$desktop', + [$v_src,$tk_src,$fw_src,$v_data,$desktop],$dbg[63]) if $b_dbg_de; } } # KDE_FULL_SESSION property is only available since KDE 3.5.5. This will only @@ -29578,7 +29681,7 @@ sub de_kde_tde_data { } $desktop->[2] ||= 'Qt' if $extra > 1; - de_wm_debugger('kde 3.5 de+qt $desktop',$desktop) if $b_dbg_de; + main::feature_debugger('kde 3.5 de+qt $desktop',$desktop,$dbg[63]) if $b_dbg_de; } eval $end if $b_log; } @@ -29622,7 +29725,8 @@ sub de_xfce_data { if ($extra > 1 && $v_data && @$v_data){ ($desktop->[2],$desktop->[3]) = item_from_version($v_data,['^Built with GTK',4,'Gtk']); } - de_wm_debugger('xfce $program,$desktop',[$program,$desktop]) if $b_dbg_de; + main::feature_debugger('xfce $program,$desktop',[$program,$desktop], + $dbg[63]) if $b_dbg_de; } eval $end if $b_log; } @@ -29682,7 +29786,7 @@ sub de_env_data { } $tk_test = $item->[4] if !$desktop->[3]; } - de_wm_debugger('env de-wm',$desktop) if $b_dbg_de; + main::feature_debugger('env de-wm',$desktop,$dbg[63]) if $b_dbg_de; last; } } @@ -29707,7 +29811,8 @@ sub de_misc_data { (($program = main::check_program($xprop{$de}->{'name'})) || ($xprop{$de}->{'vname'} && ($program = main::check_program($xprop{$de}->{'vname'}))))){ ($desktop->[0],$desktop->[1]) = ProgramData::full($xprop{$de}->{'name'},$program); - de_wm_debugger('de misc $program,$desktop',[$program,$desktop]) if $b_dbg_de; + main::feature_debugger('de misc $program,$desktop', + [$program,$desktop],$dbg[63]) if $b_dbg_de; last; } } @@ -29746,7 +29851,8 @@ sub de_ps_data { if ($extra > 1 && $item->[4] && $v_data && @$v_data){ ($desktop->[2],$desktop->[3]) = item_from_version($v_data,$item->[4]); } - de_wm_debugger('ps de test 1 $desktop',$desktop) if $b_dbg_de; + main::feature_debugger('ps de test 1 $desktop', + $desktop,$dbg[63]) if $b_dbg_de; last; } } @@ -29754,7 +29860,8 @@ sub de_ps_data { # we're relying on the stack order to get primary before secondary wm my $de = shift(@working); ($desktop->[0],$desktop->[1]) = ProgramData::full($de); - de_wm_debugger('ps de test 2 $desktop',$desktop) if $b_dbg_de; + main::feature_debugger('ps de test 2 $desktop', + $desktop,$dbg[63]) if $b_dbg_de; } } eval $end if $b_log; @@ -29767,7 +29874,8 @@ sub tk_gtk_data { eval $start if $b_log; if (main::check_program('gtk-launch')){ ($desktop->[2],$desktop->[3]) = ProgramData::full('gtk-launch'); - de_wm_debugger('gtk $desktop 2,3',[$desktop->[2],$desktop->[3]]) if $b_dbg_de; + main::feature_debugger('gtk $desktop 2,3', + [$desktop->[2],$desktop->[3]],$dbg[63]) if $b_dbg_de; } eval $end if $b_log; } @@ -29816,8 +29924,8 @@ sub tk_qt_data { ($desktop->[2],$desktop->[3]) = ProgramData::full('kded-qt',$program); } if ($b_dbg_de && ($desktop->[2] || $desktop->[3])){ - de_wm_debugger('qt $program,qt,v $desktop 2,3', - [$program,$desktop->[2],$desktop->[3]]); + main::feature_debugger('qt $program,qt,v $desktop 2,3', + [$program,$desktop->[2],$desktop->[3]],$dbg[63]); } eval $end if $b_log; } @@ -29855,7 +29963,8 @@ sub wm_ps_xprop_data { $wm = 'wmaker';} wm_version('manual',$wm,$b_wm); if ($desktop->[5]){ - de_wm_debugger('ps wm,v $desktop 5,6',[$desktop->[5],$desktop->[6]]) if $b_dbg_de; + main::feature_debugger('ps wm,v $desktop 5,6', + [$desktop->[5],$desktop->[6]],$dbg[63]) if $b_dbg_de; last; } } @@ -29877,9 +29986,8 @@ sub wm_ps_xprop_data { } $working = $xprop{$wm}->{'vname'} if $xprop{$wm}->{'vname'}; wm_version('manual',$working,$b_wm); - if ($b_dbg_de){ - de_wm_debugger('xprop wm,v $desktop 5,6', [$desktop->[5],$desktop->[6]]); - } + main::feature_debugger('xprop wm,v $desktop 5,6', + [$desktop->[5],$desktop->[6]],$dbg[63]) if $b_dbg_de; last; } } @@ -29915,7 +30023,8 @@ sub wm_wmctrl_data { elsif ($desktop_session eq 'trinity' && lc($desktop->[5]) eq 'kwin'){ $desktop->[5] = 'Twin';} wm_version('wmctrl',$desktop->[5]); - de_wm_debugger('wmctrl wm,v $desktop 5,6',[$desktop->[5],$desktop->[6]]) if $b_dbg_de; + main::feature_debugger('wmctrl wm,v $desktop 5,6', + [$desktop->[5],$desktop->[6]],$dbg[63]) if $b_dbg_de; } eval $end if $b_log; } @@ -29953,9 +30062,7 @@ sub wm_version { sub components_data { eval $start if $b_log; if (@{$ps_data{'components-active'}}){ - my $sep = ','; - main::set_join_sep($ps_data{'components-active'},\$sep); - $desktop->[4] = join($sep, @{$ps_data{'components-active'}}); + main::make_list_value($ps_data{'components-active'},\$desktop->[4],',','sort'); } eval $end if $b_log; } @@ -29964,9 +30071,7 @@ sub tools_data { eval $start if $b_log; # these are running/active if (@{$ps_data{'tools-active'}}){ - my $sep = ','; - main::set_join_sep($ps_data{'tools-active'},\$sep); - $desktop->[7] = join($sep, @{$ps_data{'tools-active'}}); + main::make_list_value($ps_data{'tools-active'},\$desktop->[7],',','sort'); } # now check if any are available but not running/services if ($b_admin){ @@ -29984,37 +30089,13 @@ sub tools_data { } } if (@$installed){ - my $sep = ','; - main::set_join_sep($installed,\$sep); - $desktop->[8] = join($sep, @$installed); + main::make_list_value($installed,\$desktop->[8],',','sort'); } } eval $end if $b_log; } ## UTILITIES ## -# args: 0: $type; 1: data -sub de_wm_debugger { - my ($type,$data) = @_; - my @result; - push(@result,'sub: ' . (caller(1))[3],'type: ' . $type); - if (ref $data eq 'ARRAY' || ref $data eq 'HASH'){ - $data = Data::Dumper::Dumper $data; - } - else { - $data .= "\n" if !$b_log; - } - push(@result,'data: ' . $data); - # note, if --debug 3 and --dbg 63 used, we want this to print out - if (!$b_log || ($dbg[63] && $debugger{'level'} < 10)){ - unshift(@result,'------------------'); - push(@result,"------------------\n") if $b_log; - print join("\n",@result); - } - else { - main::log_data('dump','de dbg @result',\@result); - } -} # args: 0: raw $version data ref; 1: [search regex, split pos, print name] # returns item print name, version @@ -30049,12 +30130,12 @@ sub set_env_data { $kde_session_version = ($ENV{'KDE_SESSION_VERSION'}) ? $ENV{'KDE_SESSION_VERSION'} : ''; # for fallback to fallback protections re false gnome id $gdmsession = ($ENV{'GDMSESSION'}) ? clean_env($ENV{'GDMSESSION'}) : ''; - de_wm_debugger('desktop-scalars', + main::feature_debugger('desktop-scalars', ['$desktop_session: ' . $desktop_session, '$xdg_desktop: ' . $xdg_desktop, '$kde_full_session: ' . $kde_full_session, '$kde_session_version: ' . $kde_session_version, - '$gdmsession: ' . $gdmsession]) if $b_dbg_de; + '$gdmsession: ' . $gdmsession],$dbg[63]) if $b_dbg_de; } # Note: an ubuntu regresssion replaces or adds 'ubuntu' string to @@ -30123,7 +30204,8 @@ sub set_xprop { } } } - de_wm_debugger('xprop data: working, results',[$data,\%xprop]) if $b_dbg_de; + main::feature_debugger('xprop data: working, results', + [$data,\%xprop],$dbg[63]) if $b_dbg_de; eval $end if $b_log; } } @@ -31359,64 +31441,113 @@ sub test_ps_dm { ## DistroData { package DistroData; -my (@distro_files,@osr,@working); -my ($distro,$distro_file,$distro_id,$system_base) = ('','','',''); +my ($id_src,@osr,@working); my ($etc_issue,$lc_issue,$os_release) = ('','','/etc/os-release'); +my $distro = { +'base' => '', +'base-files' => [], +'base-method' => [], +'file' => '', +'files' => [], +'id' => '', +'method' => [], +'name' => '', +}; sub get { eval $start if $b_log; + if ($dbg[66] || $b_log){ + $distro->{'dbg'} = 1; + } if ($bsd_type){ - get_bsd_os(); + get_distro_bsd(); } else { - get_linux_distro(); + get_distro_linux(); } eval $end if $b_log; - return ($distro,$system_base); + return $distro; } -sub get_bsd_os { +## BSD ## +sub get_distro_bsd { eval $start if $b_log; # used to parse /System/Library/CoreServices/SystemVersion.plist for Darwin # but dumping that since it broke, just using standard BSD uname 0 2 name. - if (!$distro){ + if (!$distro->{'name'}){ my $bsd_type_osr = 'dragonfly'; - @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 (-r $os_release){ + @osr = main::reader($os_release); + push(@{$distro->{'files'}},$os_release) if $distro->{'dbg'}; + if (@osr && $bsd_type =~ /($bsd_type_osr)/ && (grep {/($bsd_type_osr)/i} @osr)){ + $distro->{'name'} = get_osr(); + $distro->{'id'} = lc($1); + push(@{$distro->{'method'}},$os_release); + } } } - if (!$distro){ + if (!$distro->{'name'}){ 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 (-r $version_file){ + $version_info = main::reader($version_file,'strip'); + push(@{$distro->{'files'}},$version_file) if $distro->{'dbg'}; + if ($version_info && $version_info =~ /($bsd_type_version)/i){ + $distro->{'name'} = $version_info; + $distro->{'id'} = lc($1); + push(@{$distro->{'method'}},$version_file); + } } } - if (!$distro){ + if (!$distro->{'name'}){ # 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]); + $distro->{'name'} = "$uname[0] $uname[2]"; + $distro->{'id'} = lc($uname[0]); + push(@{$distro->{'method'}},'uname 0, 2'); } - if ($distro && + if ($distro->{'name'} && (-e '/etc/pkg/GhostBSD.conf' || -e '/usr/local/etc/pkg/repos/GhostBSD.conf') && - $distro =~ /freebsd/i){ + $distro->{'name'} =~ /freebsd/i){ my $version = (main::grabber("pkg query '%v' os-generic-userland-base 2>/dev/null"))[0]; # only swap if we get result from the query if ($version){ - $system_base = $distro; - $distro = "GhostBSD $version"; + $distro->{'base'} = $distro->{'name'}; + $distro->{'name'} = "GhostBSD $version"; + push(@{$distro->{'method'}},'pkg query'); } } + if ($distro->{'dbg'}){ + dbg_distro_files('BSD',$distro->{'files'}); + main::feature_debugger('name: $distro: pre-base [bsd]',$distro); + } system_base_bsd() if $extra > 0; eval $end if $b_log; } -sub get_linux_distro { +sub system_base_bsd { + eval $start if $b_log; + # ghostbsd is handled in main bsd section + if (lc($uname[1]) eq 'nomadbsd' && $distro->{'id'} eq 'freebsd'){ + $distro->{'base'} = $distro->{'name'}; + $distro->{'name'} = $uname[1]; + push(@{$distro->{'method-base'}},'uname 1'); + } + elsif (-f '/etc/pkg/HardenedBSD.conf' && $distro->{'id'} eq 'freebsd'){ + $distro->{'base'} = $distro->{'name'}; + $distro->{'name'} = 'HardenedBSD'; + push(@{$distro->{'method-base'}},'/etc/pkg/HardenedBSD.conf'); + } + elsif ($distro->{'id'} =~ /^(truenas)$/){ + $distro->{'base'} = "$uname[0] $uname[2]"; + push(@{$distro->{'method-base'}},'uname 0 + 2'); + } + main::feature_debugger('system-base: $distro [bsd]',$distro) if $distro->{'dbg'}; + eval $end if $b_log; +} + +# GNU/LINUX ## +sub get_distro_linux { # NOTE: increasingly no distro release files are present, so this logic is # deprecated, but still works often. # order matters! @@ -31425,16 +31556,16 @@ sub get_linux_distro { pardus-release porteus-version q4os_version sabayon-release siduction-version sidux-version slax-version slint-version slitaz-release solusos-release turbolinux-release zenwalk-version); - my $derived_s = join('|', @derived); + my $derived_str = join('|', @derived); my @primary = qw(altlinux-release arch-release gentoo-release redhat-release slackware-version SuSE-release); - my $primary_s = join('|', @primary); - my $exclude_s = 'debian_version|devuan_version|ubuntu_version'; + my $primary_str = join('|', @primary); + my $exclude_str = 'debian_version|devuan_version|ubuntu_version'; # note, pclinuxos has all these mandrake/mandriva files, careful! - my $lsb_good_s = 'mandrake-release|mandriva-release|mandrakelinux-release|'; - $lsb_good_s .= 'manjaro-release'; - my $os_release_good_s = 'altlinux-release|arch-release|mageia-release|'; - $os_release_good_s .= 'pclinuxos-release|rpi-issue|SuSE-release'; + my $lsb_good_str = 'mandrake-release|mandriva-release|mandrakelinux-release|'; + $lsb_good_str .= 'manjaro-release'; + my $osr_good_str = 'altlinux-release|arch-release|mageia-release|'; + $osr_good_str .= 'pclinuxos-release|rpi-issue|SuSE-release'; # We need these empirically verified one by one as they appear, but always remember # that stuff changes, legacy, deprecated, but these ideally are going to be right my $osr_good = 'antergos|chakra|fedora|guix|mageia|manjaro|oracle|pclinuxos|'; @@ -31442,8 +31573,7 @@ sub get_linux_distro { # Force use of pretty name because that's only location of derived distro name # devuan should catch many devuans spins, which often put their names in pretty my $osr_pretty = 'devuan|slackel|zinc'; - my $distro_file_name = 'slitaz'; # these may not have the distro name in the file - my ($b_issue,$b_lsb,$b_osr_pretty,$b_skip_issue,$b_skip_osr); + my $dist_file_no_name = 'slitaz'; # these may not have the distro name in the file my ($issue,$lsb_release) = ('/etc/issue','/etc/lsb-release'); # Note: OpenSuse Tumbleweed 2018-05 has made /etc/issue created by sym link to /run/issue # and then made that resulting file 700 permissions, which is obviously a mistake @@ -31455,33 +31585,33 @@ sub get_linux_distro { # /etc/lsb-release-crunchbang # Wait to handle since crunchbang file is one of the few in the world that # uses this method - @distro_files = main::globber('/etc/*[-_]{[rR]elease,[vV]ersion,issue}*'); - push(@distro_files, '/etc/bodhibuilder.conf') if -r '/etc/bodhibuilder.conf'; # legacy + @{$distro->{'files'}} = main::globber('/etc/{*[-_]{[rR]elease,[vV]ersion}*,issue}'); + push(@{$distro->{'files'}}, '/etc/bodhibuilder.conf') if -r '/etc/bodhibuilder.conf'; # legacy @osr = main::reader($os_release) if -r $os_release; if (-f '/etc/bodhi/info'){ $lsb_release = '/etc/bodhi/info'; - $distro_file = $lsb_release; - $b_skip_issue = 1; - push(@distro_files, $lsb_release); + $distro->{'file'} = $lsb_release; + $distro->{'issue-skip'} = 1; + push(@{$distro->{'files'}}, $lsb_release); } - $b_issue = 1 if -f $issue; - $b_lsb = 1 if -f $lsb_release; - if (!$b_skip_issue && $etc_issue){ + $distro->{'issue'} = $issue if -f $issue; + $distro->{'lsb'} = $lsb_release if -f $lsb_release; + if (!$distro->{'issue-skip'} && $etc_issue){ $lc_issue = lc($etc_issue); if ($lc_issue =~ /(antergos|grml|linux lite|openmediavault)/){ - $distro_id = $1; - $b_skip_issue = 1; + $distro->{'id'} = $1; + $distro->{'issue-skip'} = 1; } # This raspbian detection fails for raspberry pi os elsif ($lc_issue =~ /(raspbian|peppermint)/){ - $distro_id = $1; - $distro_file = $os_release if @osr; + $distro->{'id'} = $1; + $distro->{'file'} = $os_release if @osr; } # Note: wrong fix, applies to both raspbian and raspberry pi os # assumption here is that r pi os fixes this before stable release elsif ($lc_issue =~ /^debian/ && -e '/etc/apt/sources.list.d/raspi.list' && (grep {/[^#]+raspberrypi\.org/} main::reader('/etc/apt/sources.list.d/raspi.list'))){ - $distro_id = 'raspios' ; + $distro->{'id'} = 'raspios' ; } } # Note that antergos changed this around # 2018-05, and now lists @@ -31489,129 +31619,140 @@ sub get_linux_distro { # if it contains their names. Last check below if (@osr){ if (grep {/($osr_good)/i} @osr){ - $distro_file = $os_release; + $distro->{'file'} = $os_release; } elsif (grep {/($osr_pretty)/i} @osr){ - $b_osr_pretty = 1; - $distro_file = $os_release; + $distro->{'osr-pretty'} = 1; + $distro->{'file'} = $os_release; } } - if (grep {/armbian/} @distro_files){ - $distro_id = 'armbian' ; + if (grep {/armbian/} @{$distro->{'files'}}){ + $distro->{'id'} = 'armbian' ; } - main::log_data('dump','@distro_files',\@distro_files) if $b_log; - main::log_data('data',"distro_file-1: $distro_file") if $b_log; - if (!$distro_file){ - if (scalar @distro_files == 1){ - $distro_file = $distro_files[0]; + $distro->{'file-for-0'} = $distro->{'file'}; + dbg_distro_files('Linux',$distro->{'files'}) if $distro->{'dbg'}; + if (!$distro->{'file'}){ + if (scalar @{$distro->{'files'}} == 1){ + $distro->{'file'} = $distro->{'files'}[0]; } - elsif (scalar @distro_files > 1){ + elsif (scalar @{$distro->{'files'}} > 1){ # Special case, to force manjaro/antergos which also have arch-release # manjaro should use lsb, which has the full info, arch uses os release # antergos should use /etc/issue. We've already checked os-release above - if ($distro_id eq 'antergos' || (grep {/antergos|chakra|manjaro/} @distro_files)){ - @distro_files = grep {!/arch-release/} @distro_files; + if ($distro->{'id'} eq 'antergos' || (grep {/antergos|chakra|manjaro/} @{$distro->{'files'}})){ + @{$distro->{'files'}} = grep {!/arch-release/} @{$distro->{'files'}}; } - my $distro_files_s = join('|', @distro_files); - @working = (@derived,@primary); - foreach my $file (@working){ - if ("/etc/$file" =~ /($distro_files_s)$/){ + my $dist_files_str = join('|', @{$distro->{'files'}}); + foreach my $file ((@derived,@primary)){ + if ("/etc/$file" =~ /($dist_files_str)$/){ # These is for only those distro's with self named release/version files # because Mint does not use such, it must be done as below # Force use of os-release file in cases where there might be conflict # between lsb-release rules and os-release priorities. - if (@osr && $file =~ /($os_release_good_s)$/){ - $distro_file = $os_release; + if (@osr && $file =~ /($osr_good_str)$/){ + $distro->{'file'} = $os_release; } # Now lets see if the distro file is in the known-good working-lsb-list # if so, use lsb-release, if not, then just use the found file - elsif ($b_lsb && $file =~ /$lsb_good_s/){ - $distro_file = $lsb_release; + elsif ($distro->{'lsb'} && $file =~ /$lsb_good_str/){ + $distro->{'file'} = $lsb_release; } else { - $distro_file = "/etc/$file"; + $distro->{'file'} = "/etc/$file"; } last; } } } } - main::log_data('data',"distro_file-2: $distro_file") if $b_log; + $distro->{'file-for-1'} = $distro->{'file'}; # first test for the legacy antiX distro id file if (-r '/etc/antiX'){ @working = main::reader('/etc/antiX'); - $distro = main::awk(\@working,'antix.*\.iso') if @working; - $distro = main::clean_characters($distro) if $distro; + $distro->{'name'} = main::awk(\@working,'antix.*\.iso') if @working; + $distro->{'name'} = main::clean_characters($distro->{'name'}) if $distro->{'name'}; + push(@{$distro->{'method'}},'file: /etc/antiX'); } # This handles case where only one release/version file was found, and it's lsb-release. # This would never apply for ubuntu or debian, which will filter down to the following # conditions. In general if there's a specific distro release file available, that's to # be preferred, but this is a good backup. - elsif ($distro_file && $b_lsb && - ($distro_file =~ /\/etc\/($lsb_good_s)$/ || $distro_file eq $lsb_release)){ - print "df: $distro_file lf: $lsb_release\n"; - $distro = get_lsb_release($lsb_release); + elsif ($distro->{'file'} && $distro->{'lsb'} && + ($distro->{'file'} =~ /\/etc\/($lsb_good_str)$/ || $distro->{'file'} eq $lsb_release)){ + # print "df: $distro->{'file'} lf: $lsb_release\n"; + $distro->{'name'} = get_lsb($lsb_release); + push(@{$distro->{'method'}},'get_lsb(): primary'); } - elsif ($distro_file && $distro_file eq $os_release){ - $distro = get_os_release($b_osr_pretty); - $b_skip_osr = 1; + elsif ($distro->{'file'} && $distro->{'file'} eq $os_release){ + $distro->{'name'} = get_osr(); + $distro->{'osr-skip'} = 1; + push(@{$distro->{'method'}},'get_osr(): primary'); } # If distro id file was found and it's not in the exluded primary distro file list, read it - elsif ($distro_file && -s $distro_file && $distro_file !~ /\/etc\/($exclude_s)$/){ + elsif ($distro->{'file'} && -s $distro->{'file'} && $distro->{'file'} !~ /\/etc\/($exclude_str)$/){ # New opensuse uses os-release, but older ones may have a similar syntax, so just use # the first line - if ($distro_file eq '/etc/SuSE-release'){ + if ($distro->{'file'} eq '/etc/SuSE-release'){ # Leaving off extra data since all new suse have it, in os-release, this file has # line breaks, like os-release but in case we want it, it's: # CODENAME = Mantis | VERSION = 12.2 # For now, just take first occurrence, which should be the first line, which does # not use a variable type format - @working = main::reader($distro_file); - $distro = main::awk(\@working,'suse'); + @working = main::reader($distro->{'file'}); + $distro->{'name'} = main::awk(\@working,'suse'); + push(@{$distro->{'method'}}, 'custom: suse-release'); } - elsif ($distro_file eq '/etc/bodhibuilder.conf'){ - @working = main::reader($distro_file); - $distro = main::awk(\@working,'^LIVECDLABEL',2,'\s*=\s*'); - $distro =~ s/"//g if $distro; + elsif ($distro->{'file'} eq '/etc/bodhibuilder.conf'){ + @working = main::reader($distro->{'file'}); + $distro->{'name'} = main::awk(\@working,'^LIVECDLABEL',2,'\s*=\s*'); + $distro->{'name'} =~ s/"//g if $distro->{'name'}; + push(@{$distro->{'method'}},'custom: /etc/bodhibuilder'); } else { - $distro = main::reader($distro_file,'',0); + $distro->{'name'} = main::reader($distro->{'file'},'',0); # only contains version number. Why? who knows. - if ($distro_file eq '/etc/q4os_version' && $distro !~ /q4os/i){ - $distro = "Q4OS $distro" ; + if ($distro->{'file'} eq '/etc/q4os_version' && $distro->{'name'} !~ /q4os/i){ + $distro->{'name'} = "Q4OS $distro->{'name'}" ; } + push(@{$distro->{'method'}},'default: distro file'); + } + if ($distro->{'name'}){ + $distro->{'name'} = main::clean_characters($distro->{'name'}); } - $distro = main::clean_characters($distro) if $distro; } # Otherwise try the default debian/ubuntu/distro /etc/issue file - elsif ($b_issue){ - if (!$distro_id && $lc_issue && $lc_issue =~ /(mint|lmde)/){ - $distro_id = $1; - $b_skip_issue = 1; + elsif ($distro->{'issue'}){ + if (!$distro->{'id'} && $lc_issue && $lc_issue =~ /(mint|lmde)/){ + $distro->{'id'} = $1; + $distro->{'issue-skip'} = 1; } # os-release/lsb gives more manageable and accurate output than issue, # but mint should use issue for now. Antergos uses arch os-release, but issue shows them - if (!$b_skip_issue && @osr){ - $distro = get_os_release($b_osr_pretty); - $b_skip_osr = 1; + if (!$distro->{'issue-skip'} && @osr){ + $distro->{'name'} = get_osr(); + $distro->{'osr-skip'} = 1; + push(@{$distro->{'method'}},'get_osr(): w/issue'); } - elsif (!$b_skip_issue && $b_lsb){ - $distro = get_lsb_release(); + elsif (!$distro->{'issue-skip'} && $distro->{'lsb'}){ + $distro->{'name'} = get_lsb(); + push(@{$distro->{'method'}},'get_lsb(): w/issue'); } elsif ($etc_issue){ if (-d '/etc/guix' && $lc_issue =~ /^this is the gnu system\./){ # No standard paths or files for os data, use pm version - ($distro,my $version) = ProgramData::full('guix'); - $distro .= " $version" if $version; - $b_skip_issue = 1; + ($distro->{'name'},my $version) = ProgramData::full('guix'); + $distro->{'name'} .= " $version" if $version; + $distro->{'issue-skip'} = 1; + push(@{$distro->{'method'}},'issue-id; from program version'); } else { - $distro = $etc_issue; + $distro->{'name'} = $etc_issue; + push(@{$distro->{'method'}},'issue: source'); # This handles an arch bug where /etc/arch-release is empty and /etc/issue # is corrupted only older arch installs that have not been updated should # have this fallback required, new ones use os-release - if ($distro =~ /arch linux/i){ - $distro = 'Arch Linux'; + if ($distro->{'name'} =~ /arch linux/i){ + $distro->{'name'} = 'Arch Linux'; } } } @@ -31619,65 +31760,84 @@ sub get_linux_distro { # A final check. If a long value, before assigning the debugger output, if os-release # exists then let's use that if it wasn't tried already. Maybe that will be better. # not handling the corrupt data, maybe later if needed. 10 + distro: (8) + string - if ($distro && length($distro) > 60){ - if (!$b_skip_osr && @osr){ - $distro = get_os_release($b_osr_pretty); - $b_skip_osr = 1; + if ($distro->{'name'} && length($distro->{'name'}) > 60){ + if (!$distro->{'osr-skip'} && @osr){ + $distro->{'name'} = get_osr(); + $distro->{'osr-skip'} = 1; + push(@{$distro->{'method'}},'get_osr(): bad name'); } } # Test for /etc/lsb-release as a backup in case of failure, in cases # where > one version/release file were found but the above resulted # in null distro value. - if (!$distro && $windows{'cygwin'}){ - $distro = $uname[0]; # like so: CYGWIN_NT-10.0-19043 - $b_skip_osr = 1; + if (!$distro->{'name'} && $windows{'cygwin'}){ + $distro->{'name'} = $uname[0]; # like so: CYGWIN_NT-10.0-19043 + $distro->{'osr-skip'} = 1; + push(@{$distro->{'method'}},'uname 0: cygwin'); } - if (!$distro){ - if (!$b_skip_osr && @osr){ - $distro = get_os_release($b_osr_pretty); - $b_skip_osr = 1; + if (!$distro->{'name'}){ + if (!$distro->{'osr-skip'} && @osr){ + $distro->{'name'} = get_osr(); + $distro->{'osr-skip'} = 1; + push(@{$distro->{'method'}},'get_osr(): final'); } - elsif ($b_lsb){ - $distro = get_lsb_release(); + elsif ($distro->{'lsb'}){ + $distro->{'name'} = get_lsb(); + push(@{$distro->{'method'}},'get_lsb(): final'); } } # Now some final null tries - if (!$distro){ + if (!$distro->{'name'}){ # If the file was null but present, which can happen in some cases, then use # the file name itself to set the distro value. Why say unknown if we have # a pretty good idea, after all? - if ($distro_file){ - $distro_file =~ s/\/etc\/|[-_]|release|version//g; - $distro = $distro_file; + if ($distro->{'file'}){ + $distro->{'file'} =~ s/\/etc\/|[-_]|release|version//g; + $distro->{'name'} = $distro->{'file'}; + push(@{$distro->{'method'}},'use: distro file name'); } } - system_base() if $extra > 0; + main::feature_debugger('name: $distro: pre-base [linux]',$distro) if $distro->{'dbg'}; + system_base_linux() if $extra > 0; # Some last customized changes, double check if possible to verify still valid - if ($distro){ - if ($distro_id eq 'armbian'){ - $distro =~ s/Debian/Armbian/; - } - elsif ($distro_id eq 'raspios'){ - $system_base = $distro; + if ($distro->{'name'}){ + if ($distro->{'id'} eq 'armbian'){ + $distro->{'name'} =~ s/Debian/Armbian/; + push(@{$distro->{'method'}},'custom: armbian name adjust'); + } + elsif ($distro->{'id'} eq 'raspios'){ + $distro->{'base'} = $distro->{'name'}; + push(@{$distro->{'base-method'}},'custom: pi base from name'); # No need to repeat the debian version info if base: - if ($extra == 0){$distro =~ s/Debian\s*GNU\/Linux/Raspberry Pi OS/;} - else {$distro = 'Raspberry Pi OS';} + if ($extra == 0){ + $distro->{'name'} =~ s/Debian\s*GNU\/Linux/Raspberry Pi OS/; + } + else { + $distro->{'name'} = 'Raspberry Pi OS'; + } + push(@{$distro->{'method'}},'custom: pi name adjust'); } # check for spins, relies on xdg directory name - elsif ($distro =~ /^(Ubuntu)/i){ + elsif ($distro->{'name'} =~ /^(Ubuntu)/i){ my $base = $1; - my $temp = distro_spin($distro); - if ($temp ne $distro){ - $system_base = $base if !$system_base && $extra > 0; - $distro = $temp; + my $temp = distro_spin($distro->{'name'}); + if ($temp ne $distro->{'name'}){ + if (!$distro->{'base'} && $extra > 0){ + $distro->{'base'} = $base; + push(@{$distro->{'base-method'}},'use: name'); + } + $distro->{'name'} = $temp; + push(@{$distro->{'method'}},'use: distro_spin()'); } } - elsif (-d '/etc/salixtools/' && $distro =~ /Slackware/i){ - $distro =~ s/Slackware/Salix/; + elsif (-d '/etc/salixtools/' && $distro->{'name'} =~ /Slackware/i){ + $distro->{'name'} =~ s/Slackware/Salix/; + push(@{$distro->{'method'}},'manual: name swap'); } - elsif ($distro_file =~ /($distro_file_name)/ && $distro =~ /^[\d\.]+$/){ - $distro_file =~ s/\/etc\/|[-_]|release|version//g; - $distro = ucfirst($distro_file) . ' ' . $distro; + elsif ($distro->{'file'} =~ /($dist_file_no_name)/ && $distro->{'name'} =~ /^[\d\.]+$/){ + $distro->{'file'} =~ s/\/etc\/|[-_]|release|version//g; + $distro->{'name'} = ucfirst($distro->{'file'}) . ' ' . $distro->{'name'}; + push(@{$distro->{'method'}},'use: file name'); } } else { @@ -31685,49 +31845,37 @@ sub get_linux_distro { android_info() if $b_android; } ## Finally, if all else has failed, give up - $distro ||= 'unknown'; + $distro->{'name'} ||= 'unknown'; + if ($extra > 0 && $distro->{'name'} && $distro->{'base'}){ + check_base(); + } + main::feature_debugger('name: $distro: final [linux]',$distro) if $distro->{'dbg'}; eval $end if $b_log; } sub android_info { eval $start if $b_log; main::set_build_prop() if !$loaded{'build-prop'};; - $distro = 'Android'; - $distro .= ' ' . $build_prop{'build-version'} if $build_prop{'build-version'}; - $distro .= ' ' . $build_prop{'build-date'} if $build_prop{'build-date'}; + $distro->{'name'} = 'Android'; + $distro->{'name'} .= ' ' . $build_prop{'build-version'} if $build_prop{'build-version'}; + $distro->{'name'} .= ' ' . $build_prop{'build-date'} if $build_prop{'build-date'}; if (!$show{'machine'}){ if ($build_prop{'product-manufacturer'} && $build_prop{'product-model'}){ - $distro .= ' (' . $build_prop{'product-manufacturer'} . ' ' . $build_prop{'product-model'} . ')'; + $distro->{'name'} .= ' (' . $build_prop{'product-manufacturer'} . ' ' . $build_prop{'product-model'} . ')'; } elsif ($build_prop{'product-device'}){ - $distro .= ' (' . $build_prop{'product-device'} . ')'; + $distro->{'name'} .= ' (' . $build_prop{'product-device'} . ')'; } elsif ($build_prop{'product-name'}){ - $distro .= ' (' . $build_prop{'product-name'} . ')'; + $distro->{'name'} .= ' (' . $build_prop{'product-name'} . ')'; } } eval $end if $b_log; } -sub system_base_bsd { - eval $start if $b_log; - # ghostbsd is handled in main bsd section - if (lc($uname[1]) eq 'nomadbsd' && $distro_id eq 'freebsd'){ - $system_base = $distro; - $distro = $uname[1]; - } - 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; -} - -sub system_base { +sub system_base_linux { eval $start if $b_log; + $distro->{'osr-pretty'} = 0; # reset: if we want to use osr pretty, detect here. # Need data on these Arch derived: CachyOS; can be ArchLab/Labs my $base_distro_arch = 'anarchy|antergos|apricity'; $base_distro_arch .= '|arch(bang|craft|ex|lab|man|strike)|arco|artix'; @@ -31773,98 +31921,114 @@ sub system_base { # and anyone else who uses this method for fallback ID if (-r $base_upstream_osr){ my @osr_working = main::reader($base_upstream_osr); + push(@{$distro->{'base-files'}},$base_upstream_osr) if $distro->{'dbg'}; if (@osr_working){ - my (@osr_temp); - @osr_temp = @osr; + my @osr_temp = @osr; @osr = @osr_working; - $system_base = get_os_release(); - @osr = @osr_temp if !$system_base; - (@osr_temp,@osr_working) = (); + $distro->{'base'} = get_osr(); + @osr = @osr_temp if !$distro->{'base'}; + push(@{$distro->{'base-method'}},'get_osr(): upstream osr'); } } # note: ultramarine trips this one but uses os-release field names, sigh, ignore elsif (-r $base_upstream_lsb){ - $system_base = get_lsb_release($base_upstream_lsb); + $distro->{'base'} = get_lsb($base_upstream_lsb); + push(@{$distro->{'base-files'}},$base_upstream_lsb) if $distro->{'dbg'}; + push(@{$distro->{'base-method'}},'get_lsb(): upstream lsb'); } - # probably no need for these @osr greps, just grep $distro instead? - if (!$system_base && @osr){ - my ($base_type) = (''); + dbg_distro_files('Linux base',$distro->{'base-files'}) if $distro->{'dbg'}; + # probably no need for these @osr greps, just grep $distro->{'name'} instead? + if (!$distro->{'base'} && @osr){ if ($etc_issue && (grep {/($base_issue)/i} @osr)){ - $system_base = $etc_issue; + $distro->{'base'} = $etc_issue; + push(@{$distro->{'base-method'}},'file: /etc/issue'); } # more tests added here for other ubuntu derived distros - elsif (@distro_files && (grep {/($base_default)/} @distro_files)){ - $base_type = 'default'; + elsif (@{$distro->{'files'}} && (grep {/($base_default)/} @{$distro->{'files'}})){ + $distro->{'base-type'} = 'default'; } # 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('debian'); + $distro->{'base'} = debian_id('debian'); + push(@{$distro->{'base-method'}},'use: debian_id(debian)'); } elsif (grep {/($base_osr_devuan_version)/i} @osr){ - $system_base = debian_id('devuan'); + $distro->{'base'} = debian_id('devuan'); + push(@{$distro->{'base-method'}},'use: debian_id(devuan)'); } elsif (grep {/($base_osr_fedora)/i} @osr){ - $base_type = 'fedora'; + $distro->{'base-type'} = 'fedora'; } elsif (grep {/($base_osr_redhat)/i} @osr){ - $base_type = 'rhel'; + $distro->{'base-type'} = 'rhel'; } elsif (grep {/($base_osr_ubuntu)/i} @osr){ - $base_type = 'ubuntu'; + $distro->{'base-type'} = 'ubuntu'; } - elsif ((($distro_id && $distro_id =~ /($base_osr_issue)/) || - (@distro_files && (grep {/($base_osr)/} @distro_files))) && + elsif ((($distro->{'id'} && $distro->{'id'} =~ /($base_osr_issue)/) || + (@{$distro->{'files'}} && (grep {/($base_osr)/} @{$distro->{'files'}}))) && !(grep {/($base_osr)/i} @osr)){ - $system_base = get_os_release(); + $distro->{'base'} = get_osr(); + push(@{$distro->{'base-method'}},'get_osr(): issue match'); } - if (!$system_base && $base_type){ - $system_base = get_os_release('',$base_type); + if (!$distro->{'base'} && $distro->{'base-type'}){ + $distro->{'base'} = get_osr($distro->{'base-type'}); + push(@{$distro->{'base-method'}},'get_osr(): base-type'); } } - if (!$system_base && @distro_files && - (grep {/($base_file_debian_version)/i} @distro_files)){ - $system_base = debian_id('debian'); + if (!$distro->{'base'} && @{$distro->{'files'}} && + (grep {/($base_file_debian_version)/i} @{$distro->{'files'}})){ + $distro->{'base'} = debian_id('debian'); + push(@{$distro->{'base-method'}},'debian_id(debian): base_file_debian_version'); } - if (!$system_base && $lc_issue && $lc_issue =~ /($base_manual)/){ + if (!$distro->{'base'} && $lc_issue && $lc_issue =~ /($base_manual)/){ my $id = $1; my %manual = ( 'blankon' => 'Debian unstable', 'deepin' => 'Debian unstable', 'kali' => 'Debian testing', ); - $system_base = $manual{$id}; + $distro->{'base'} = $manual{$id}; + push(@{$distro->{'base-method'}},'manual: /etc/issue match'); } - if (!$system_base && $distro){ - if ($distro =~ /^($base_distro_arch)/i){ - $system_base = 'Arch Linux'; + if (!$distro->{'base'} && $distro->{'name'}){ + if ($distro->{'name'} =~ /^($base_distro_arch)/i){ + $distro->{'base'} = 'Arch Linux'; + push(@{$distro->{'base-method'}},'name-match: assign arch'); } - elsif ($distro =~ /^peppermint/i){ + elsif ($distro->{'name'} =~ /^peppermint/i){ my $type = (-f '/etc/devuan_version') ? 'devuan': 'debian'; - $system_base = debian_id($type); + $distro->{'base'} = debian_id($type); + push(@{$distro->{'base-method'}},'debian_id(): type'); } } - if (!$system_base && $distro){ + if (!$distro->{'base'} && $distro->{'name'}){ foreach my $key (keys %base_version){ - if (-r $base_version{$key} && $distro =~ /($key)/i){ - $system_base = main::reader($base_version{$key},'strip',0); - $system_base = main::clean_characters($system_base) if $system_base; + if (-r $base_version{$key} && $distro->{'name'} =~ /($key)/i){ + $distro->{'base'} = main::reader($base_version{$key},'strip',0); + $distro->{'base'} = main::clean_characters($distro->{'base'}) if $distro->{'base'}; + push(@{$distro->{'base-method'}},"base_version: file: $key"); last; } } } - if (!$system_base && $distro && -d '/etc/salixtools/' && $distro =~ /Slackware/i){ - $system_base = $distro; + if (!$distro->{'base'} && $distro->{'name'} && -d '/etc/salixtools/' && + $distro->{'name'} =~ /Slackware/i){ + $distro->{'base'} = $distro->{'name'}; + push(@{$distro->{'base-method'}},'custom: salix'); } + main::feature_debugger('$distro: base [linux]',$distro) if $distro->{'dbg'}; eval $end if $b_log; } +## PROCESS OS/LSB RELEASE ## # Note: corner case when parsing the bodhi distro file # args: 0: file name -sub get_lsb_release { +sub get_lsb { eval $start if $b_log; my ($lsb_file) = @_; $lsb_file ||= '/etc/lsb-release'; - my ($distro_lsb,$id,$release,$codename,$description) = ('','','','',''); + my ($dist_lsb,$id,$release,$codename,$description) = ('','','','',''); my ($dist_id,$dist_release,$dist_code,$dist_desc) = ('DISTRIB_ID', 'DISTRIB_RELEASE','DISTRIB_CODENAME','DISTRIB_DESCRIPTION'); if ($lsb_file eq '/etc/bodhi/info'){ @@ -31905,27 +32069,27 @@ sub get_lsb_release { } } if (!$id && !$release && !$codename && $description){ - $distro_lsb = $description; + $dist_lsb = $description; } else { # avoid duplicates - $distro_lsb = $id; - $distro_lsb .= " $release" if $release && $distro_lsb !~ /$release/; + $dist_lsb = $id; + $dist_lsb .= " $release" if $release && $dist_lsb !~ /$release/; # eg: release: 9 codename: mga9 - if ($codename && $distro_lsb !~ /$codename/i && + if ($codename && $dist_lsb !~ /$codename/i && (!$release || $codename !~ /$release/)){ - $distro_lsb .= " $codename"; + $dist_lsb .= " $codename"; } - $distro_lsb =~ s/^\s+|\s\s+|\s+$//g; # get rid of double and trailing spaces + $dist_lsb =~ s/^\s+|\s\s+|\s+$//g; # get rid of double and trailing spaces } eval $end if $b_log; - return $distro_lsb; + return $dist_lsb; } -sub get_os_release { +sub get_osr { eval $start if $b_log; - my ($b_osr_pretty,$base_type) = @_; - my ($base_id,$base_name,$base_version,$distro_osr,$name,$name_lc,$name_pretty, + my ($base_type) = @_; + my ($base_id,$base_name,$base_version,$dist_osr,$name,$name_lc,$name_pretty, $version_codename,$version_name,$version_id) = ('','','','','','','','','',''); my @content = @osr; main::log_data('dump','@content',\@content) if $b_log; @@ -31957,7 +32121,7 @@ sub get_os_release { if ($base_type eq 'ubuntu'){ # feren,popos shows debian, feren ID ubuntu $working[1] =~ s/^(debian|ubuntu\sdebian|debian\subuntu)/ubuntu/; - $base_name = $working[1]; + $base_name = ucfirst($working[1]); } elsif ($base_type eq 'fedora' && $working[1] =~ /fedora/i){ $base_name = 'Fedora'; @@ -31987,28 +32151,28 @@ sub get_os_release { # arco shows only the release name, like kirk, in pretty name. Too many distros # are doing pretty name wrong, and just putting in the NAME value there if (!$base_type){ - if ((!$b_osr_pretty || !$name_pretty) && $name && $version_name){ - $distro_osr = $name; - $distro_osr = 'Arco Linux' if $name_lc =~ /^arco/; + if ((!$distro->{'osr-pretty'} || !$name_pretty) && $name && $version_name){ + $dist_osr = $name; + $dist_osr = 'Arco Linux' if $name_lc =~ /^arco/; if ($version_id && $version_name !~ /$version_id/){ - $distro_osr .= ' ' . $version_id; + $dist_osr .= ' ' . $version_id; } - $distro_osr .= " $version_name"; + $dist_osr .= " $version_name"; } elsif ($name_pretty && ($name_pretty !~ /tumbleweed/i && $name_lc ne 'arcolinux')){ - $distro_osr = $name_pretty; + $dist_osr = $name_pretty; } elsif ($name){ - $distro_osr = $name; + $dist_osr = $name; if ($version_id){ - $distro_osr .= ' ' . $version_id; + $dist_osr .= ' ' . $version_id; } } - if ($version_codename && $distro_osr !~ /$version_codename/i){ + if ($version_codename && $dist_osr !~ /$version_codename/i){ my @temp = split(/\s*[\/\s]\s*/, $version_codename); foreach (@temp){ - if ($distro_osr !~ /\b$_\b/i){ - $distro_osr .= " $_"; + if ($dist_osr !~ /\b$_\b/i){ + $dist_osr .= " $_"; } } } @@ -32019,42 +32183,43 @@ sub get_os_release { if ($base_type eq 'ubuntu' && !$base_version && $version_codename && $name =~ /feren/i){ $base_version = ucfirst($version_codename); - $distro =~ s/ $version_codename//; + $distro->{'name'} =~ s/ $version_codename//; } # mint 17 used ubuntu os-release, so won't have $base_version, steamos holo if ($base_name && ($base_type eq 'fedora' || $base_type eq 'rhel')){ - $distro_osr = $base_name; - $distro_osr .= ' ' . $version_id if $version_id; + $dist_osr = $base_name; + $dist_osr .= ' ' . $version_id if $version_id; } elsif ($base_name && $base_type eq 'arch'){ - $distro_osr = $base_name; + $dist_osr = $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_osr = "$base_name $base_id$base_version"; + $dist_osr = "$base_name $base_id$base_version"; } elsif ($base_type eq 'default' && ($name_pretty || ($name && $version_name))){ - $distro_osr = ($name && $version_name) ? "$name $version_name" : $name_pretty; + $dist_osr = ($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' && $name_lc =~ /^(debian|ubuntu)/ && ($name_pretty || ($name && $version_name))){ - $distro_osr = ($name && $version_name) ? "$name $version_name": $name_pretty; + $dist_osr = ($name && $version_name) ? "$name $version_name": $name_pretty; } elsif ($base_type eq 'debian' && $base_version){ - $distro_osr = debian_id('debian',$base_version); + $dist_osr = debian_id('debian',$base_version); } # not used yet elsif ($base_type eq 'devuan' && $base_version){ - $distro_osr = debian_id('devuan',$base_version); + $dist_osr = debian_id('devuan',$base_version); } } eval $end if $b_log; - return $distro_osr; + return $dist_osr; } +## ID MATCHING TABLES ## # args: 0: distro string # note: relies on /etc/xdg/xdg-[distro-id] which is an ubuntu thing but could # work if other distros use that for spins. Xebian does but not official spin. @@ -32152,7 +32317,7 @@ sub debian_id { if ($version){ my @temp = split(/\s*[\/\s]\s*/, $version); foreach (@temp){ - if ($distro !~ /\b$_\b/i){ + if ($distro->{'name'} !~ /\b$_\b/i){ $id .= " $_"; } } @@ -32172,6 +32337,8 @@ sub ubuntu_id { my ($id) = (''); # xx.04, xx.10 my %codenames = ( + # '??' => '26.04', + # '??' => '25.10', # '??' => '25.04', # '??' => '24.10', 'noble' => '24.04 LTS', @@ -32212,6 +32379,33 @@ sub ubuntu_id { eval $end if $b_log; return $id; } + +## UTILITIES ## +sub check_base { + if (lc($distro->{'name'}) eq lc($distro->{'base'})){ + $distro->{'base'} = ''; + } + else { + my @name = split(/\s+/,$distro->{'name'}); + my @working; + foreach my $word (@name){ + if ($distro->{'base'} !~ /\b\Q$word\E\b/i || $word =~ /^[\d\.]+$/){ + push(@working,$word); + } + } + $distro->{'name'} = join(' ',@working) if @working; + } +} + +# args: 0: info; 1: list of globbed distro files +sub dbg_distro_files { + my ($info,$files) = @_; + my $contents = {}; + foreach my $file (@$files){ + $contents->{$file} = (-r $file ) ? main::reader($file,'','ref') : main::message('file-unreadable'); + } + main::feature_debugger($info . ' raw distro files:',$contents); +} } ## DmidecodeData @@ -33902,9 +34096,7 @@ sub package_counts { } } if (@tools){ - my $sep = ','; - main::set_join_sep(\@tools,\$sep); - $pmts = join($sep,sort @tools); + main::make_list_value(\@tools,\$pmts,',','sort'); } } $pms{$pm->[0]} = { @@ -34868,8 +35060,9 @@ sub sys_data { $power->{$_} =~ s/\[$1\]//; $power->{$_} =~ s/^\s+|\s+$//g; } + # some of these can get pretty long, so handle with make_list_value if ($power->{$_}){ - $power->{$_} =~ s/\s+/,/g; + main::make_list_value([split(/\s+/,$power->{$_})],\$power->{$_},','); $power->{$_ . '-avail'} = $power->{$_}; } } @@ -35477,7 +35670,7 @@ sub version_pkg { # set_cmd(): sets @ps_aux, @ps_cmd # set_dm(): sets $ps_data{'dm-active'} # set_de_wm(): sets -S/-G de/wm/comp/tools items -# set_power(): sets -I $ps_data{'power-daemons'} +# set_power(): sets -I $ps_data{'power-services'} { package PsData; @@ -35514,13 +35707,13 @@ sub set_cmd { } # we want more data from ps busybox, to get TinyX screen res my $cols_use = ($b_busybox) ? 7 : 2; - my $pattern = 'apache|brave|chrom(e|ium)|falkon|(fire|water)fox|gvfs|http|'; - $pattern .= 'konqueror|mariadb|midori|mysql|nfsd|nginx|openvpn|opera|'; - $pattern .= 'pale|postgre|php|qtwebengine|smbd|smtp|sssd|vivald'; + my $pattern = 'brave|chrom(e|ium)|falkon|(fire|water)fox|gvfs|'; + $pattern .= 'konqueror|mariadb|midori|mysql|openvpn|opera|'; + $pattern .= 'pale|postgre|php|qtwebengine|smtp|vivald'; for (@$ps){ next if !$_; next if $self_name eq 'inxi' && /\/$self_name\b/; - $_ = lc; + # $_ = lc; push (@ps_aux,$_); my @split = split(/\s+/, $_); # slice out COMMAND to last elements of psrows @@ -35576,7 +35769,7 @@ sub set_de_wm { matchbox-window-manager mcwm mini miwm mlvwm monsterwm musca mvwm mwm nawm notion openbox nscde pekwm penrose qvwm ratpoison sapphire sawfish scrotwm snapwm spectrwm stumpwm subtle tinywm tvtwm twm - uwm vtwm windowlab WindowMaker w9wm wingo wm2 wmfs wmfs2 wmii2 wmii + uwm vtwm windowlab [wW]indo[mM]aker w9wm wingo wm2 wmfs wmfs2 wmii2 wmii wmx x9wm xmonad yeahwm))); $b_wm_comp = 1; # wm: note that for all but the listed wm, the wm and desktop would be the @@ -35638,27 +35831,39 @@ sub set_de_wm { process_items(\@{$ps_data{'tools-active'}},join('|',@{$ps_data{'tools-test'}})); } if ($dbg[63]){ - DesktopData::de_wm_debugger('ps de-wm', + main::feature_debugger('ps de-wm', ['compositors-pure:',$ps_data{'compositors-pure'}, 'de-ps-detect:',$ps_data{'de-ps-detect'}, 'de-wm-compositors:',$ps_data{'de-wm-compositors'}, 'wm-main:',$ps_data{'wm-main'}, 'wm-parent:',$ps_data{'wm-parent'}, - 'wm-compositors:',$ps_data{'wm-compositors'}]); + 'wm-compositors:',$ps_data{'wm-compositors'}],$dbg[63]); } print '%ps_data: ', Data::Dumper::Dumper \%ps_data if $dbg[5]; main::log_data('dump','%ps_data',\%ps_data) if $b_log; eval $end if $b_log; } +sub set_network { + eval $start if $b_log; + process_items(\@{$ps_data{'network-services'}},join('|', qw(apache\d? + cC]onn[mM]and? dhcpd dhcpleased fingerd ftpd gated httpd inetd ircd iwd + [mM]odem[mM]nager named networkd-dispatcher [nN]etwork[mM]anager nfsd nginx + ntpd proftpd routed smbd sshd systemd-networkd systemd-timesyncd tftpd + wicd wpa_supplicant xinetd xntpd))); + print '$ps_data{network-daemons}: ', Data::Dumper::Dumper $ps_data{'network-services'} if $dbg[5]; + main::log_data('dump','$ps_data{network-daemons}',$ps_data{'network-services'}) if $b_log; + eval $end if $b_log; +} + sub set_power { eval $start if $b_log; - process_items(\@{$ps_data{'power-daemons'}},join('|', qw(apmd csd-power + process_items(\@{$ps_data{'power-services'}},join('|', qw(apmd csd-power gnome-power-manager gsd-power kpowersave org\.dracolinux\.power org_kde_powerdevil mate-power-manager power-profiles-daemon powersaved tdepowersave thermald tlp upowerd ukui-power-manager xfce4-power-manager))); - print '$ps_data{power-daemons}: ', Data::Dumper::Dumper $ps_data{'power-daemons'} if $dbg[5]; - main::log_data('dump','$ps_data{power-daemons}',$ps_data{'power-daemons'}) if $b_log; + print '$ps_data{power-daemons}: ', Data::Dumper::Dumper $ps_data{'power-services'} if $dbg[5]; + main::log_data('dump','$ps_data{power-daemons}',$ps_data{'power-services'}) if $b_log; eval $end if $b_log; } @@ -35666,7 +35871,7 @@ sub set_power { sub process_items { foreach (@ps_cmd){ # strip out python/lisp/*sh starters - if (/^(\/\S+?\/(c?lisp|perl|python|[a-z]{0,3}sh)\s+)?(|\S*?\/)($_[1])(\s|$)/i){ + if (/^(\/\S+?\/(c?lisp|perl|python|[a-z]{0,3}sh)\s+)?(|\S*?\/)($_[1])(:|\s|$)/i){ push(@{$_[0]},$4) ; # deal with duplicates with uniq } } @@ -37804,10 +38009,10 @@ sub info_item { } if ($b_admin){ PsData::set_power(); - if (@{$ps_data{'power-daemons'}}){ - my $sep = ','; - main::set_join_sep($ps_data{'power-daemons'},\$sep); - $data->{$data_name}[$index]{main::key($num++,0,2,'daemons')} = join($sep,@{$ps_data{'power-daemons'}}); + if (@{$ps_data{'power-services'}}){ + my $services; + main::make_list_value($ps_data{'power-services'},\$services,',','sort'); + $data->{$data_name}[$index]{main::key($num++,0,2,'services')} = $services; } } } @@ -38116,12 +38321,11 @@ sub system_item { # $data->{$data_name}[$index]{main::key($num++,0,1,'vc')} = $tty if $tty ne ''; # } my $distro_key = ($bsd_type) ? 'OS': 'Distro'; - my @distro_data = DistroData::get(); - my $distro = $distro_data[0]; - $distro ||= 'N/A'; - $data->{$data_name}[$index]{main::key($num++,1,1,$distro_key)} = $distro; - if ($extra > 0 && $distro_data[1]){ - $data->{$data_name}[$index]{main::key($num++,0,2,'base')} = $distro_data[1]; + my $distro = DistroData::get(); + $distro->{'name'} ||= 'N/A'; + $data->{$data_name}[$index]{main::key($num++,1,1,$distro_key)} = $distro->{'name'}; + if ($extra > 0 && $distro->{'base'}){ + $data->{$data_name}[$index]{main::key($num++,0,2,'base')} = $distro->{'base'}; } eval $end if $b_log; return $data; @@ -15,7 +15,7 @@ .\" with this program; if not, write to the Free Software Foundation, Inc., .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. .\" -.TH INXI 1 "2024\-01\-30" "inxi" "inxi manual" +.TH INXI 1 "2024\-02-06"inxi" "inxi manual" .SH NAME inxi \- Command line system information script for console and IRC @@ -378,6 +378,11 @@ Show WAN IP address and local interfaces (latter requires \fBifconfig\fR or Shows both IPv4 and IPv6 link IP addresses. .TP +.B \-\-ip\-limit\fR, \fB\-\-limit [\-1 \- x]\fR +Raise or lower max output limit of IP addresses for \fB\-i\fR. \fB\-1\fR +removes limit. + +.TP .B \-I \fR, \fB\-\-info\fR Show Information: processes, uptime, memory, IRC client (or shell type if run in shell, not IRC), inxi version. See \fB\-Ix\fR, \fB\-Ixx\fR, and \fB\-Ia\fR @@ -421,7 +426,7 @@ base 2 Bytes/s speeds. \fB\-Ja\fR adds USB mode. .TP .B \-l \fR, \fB\-\-label\fR Show partition labels. Use with \fB\-j\fR, \fB\-o\fR, \fB\-p\fR, and \fB\-P\fR -to show partition labels. Does nothing without one of those options. +to show partition labels. Requires one of those options. Sample: \fB\-ojpl\fR. @@ -681,6 +686,31 @@ To show partition labels or UUIDs (when available and relevant), use with \fB\-l\fR or\fB \-u\fR. .TP +.B \-\-partitions\-sort\fR, \fB\-\-ps\fR \ +[dev\-base|fs|id|label|percent\-used|size|uuid|used]\fR +Change default sort order of partition output. Corresponds to +\fBPARTITION_SORT\fR configuration item. These are the available sort options: + +\fBdev\-base\fR - \fB/dev\fR partition identifier, like \fB/dev/sda1\fR. +Note that it's an alphabetic sort, so \fBsda12\fR is before \fBsda2\fR. + +\fBfs\fR \- Partition filesystem. Note that sorts will be somewhat random if +all filesystems are the same. + +\fBid\fR \- Mount point of partition (default). + +\fBlabel\fR \- Label of partition. If partitions have no labels, +sort will be random. + +\fBpercent\-used\fR - Percentage of partition size used. + +\fBsize\fR \- KiB size of partition. + +\fBuuid\fR \- UUID of the partition. + +\fBused\fR \- KiB used of partition. + +.TP .B \-P \fR, \fB\-\-partitions\fR Show basic Partition information. Shows, if detected: \fB/ /boot /boot/efi /home /opt /tmp /usr /usr/home /var @@ -836,8 +866,8 @@ same line. .TP .B \-u \fR, \fB\-\-uuid\fR -Show partition UUIDs. Use with \fB\-j\fR, \fB\-o\fR, \fB\-p\fR, and \fB\-P\fR -to show partition labels. Does nothing without one of those options. +Show UUIDs. Use with \fB\-j\fR, \fB\-M\fR \fB\-o\fR, \fB\-p\fR, and \fB\-P\fR to +show partition/system board (not common) UUIDs. Requires one of those options. Sample: \fB\-opju\fR. @@ -1132,11 +1162,6 @@ level only applied if output width is less than max wrap width (see indents. Use configuration item \fBINDENTS\fR to make permanent. .TP -.B \-\-limit [\-1 \- x]\fR -Raise or lower max output limit of IP addresses for \fB\-i\fR. \fB\-1\fR -removes limit. - -.TP .B \-\-max\-wrap\fR, \fB\-\-wrap\-max [integer]\fR Overrides default or configuration set line starter wrap width value. Wrap max is the maximum width that inxi will wrap line starters (e.g. \fBInfo:\fR) to @@ -1165,30 +1190,6 @@ The \fBprint\fR options prints to stdout. Required for non\-screen \fB\-\-output\fR formats (json|xml). .TP -.B \-\-partition\-sort [dev\-base|fs|id|label|percent\-used|size|uuid|used]\fR -Change default sort order of partition output. Corresponds to -\fBPARTITION_SORT\fR configuration item. These are the available sort options: - -\fBdev\-base\fR - \fB/dev\fR partition identifier, like \fB/dev/sda1\fR. -Note that it's an alphabetic sort, so \fBsda12\fR is before \fBsda2\fR. - -\fBfs\fR \- Partition filesystem. Note that sorts will be somewhat random if -all filesystems are the same. - -\fBid\fR \- Mount point of partition (default). - -\fBlabel\fR \- Label of partition. If partitions have no labels, -sort will be random. - -\fBpercent\-used\fR - Percentage of partition size used. - -\fBsize\fR \- KiB size of partition. - -\fBuuid\fR \- UUID of the partition. - -\fBused\fR \- KiB used of partition. - -.TP .B \-\-separator\fR, \fB\-\-sep [character(s)]\fR Change the default output key: value separator \fB:\fR to something else. Make permanent with configuration item \fBSEP2_CONSOLE\fR. @@ -1944,7 +1945,8 @@ different from each other. If they are the identical, displays same as .TP .B \-xxx \-M\fR -\- Adds, if present, board/chassis UUID, +\- Adds, if present, board/chassis UUID, This is also activated by +\fB\-\-uuid\fR. .TP .B \-xxx \-N\fR @@ -1974,8 +1976,8 @@ gnome\-panel, lxpanel, tint2, trayer, lxqt\-panel, xfce4\-panel and many others. \- Adds (if present) \fBtools:\fR item for all detected running screensavers, -screen lockers, power daemons. Note that not all screen lockers run as -daemons/services, some are just programs called by other tools or actions. +screen lockers. Note that not all screen lockers run as daemons/services, some +are just programs called by other tools or actions. \- 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 @@ -2350,7 +2352,8 @@ Graphics: states, hibernate suspend \fBimage:\fR size, and if any suspend failures (\fBfails:\fR), how many. -\- Adds power daemons (\fBdaemons:\fR) running. +\- Adds power daemons/services (\fBservices:\fR) running. Note not all services +are daemons. \- Adds to Packages number of lib packages detected per package manager. Also adds detected package managers with 0 packages listed. Adds package manager @@ -2367,7 +2370,7 @@ Info: Processes: 651 Power: uptime: 8d 21h 32m states: freeze,mem,disk suspend: deep avail: s2idle wakeups: 14 fails: 3 hibernate: platform avail: shutdown,reboot,suspend,test_resume image: 12.49 GiB - daemons: upowerd,xfce4\-power\-manager Init: systemd v: 255 + services: upowerd,xfce4\-power\-manager Init: systemd v: 255 target: graphical (5) default: graphical tool: systemctl Packages: pm: dpkg pkgs: 3960 libs: 2184 tools: apt,apt\-get,aptitude pm: rpm pkgs: 0 Compilers: gcc: 13.2.0 alt: 5/6/8/9/10/11/12 Shell: Bash @@ -2455,6 +2458,10 @@ shown). \- Adds for USB devices USB mode (Linux only). +\- Adds \fBInfo:\fR line (\fB\-n\fR, \fB\-i\fR only), with running network type +\fBservices:\fR. Note not all services are daemons. For example, +\fBNetworkManager\fR can be started with \fB\-\-no\-daemon\fR flag. + .TP .B \-a \-o\fR \- Adds device kernel major:minor number (Linux only). diff --git a/inxi.changelog b/inxi.changelog index 08f21c4..b1fb5b5 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,4 +1,153 @@ ================================================================================ +Version: 3.3.33 +Patch: 00 +Date: 2024-02-06 +-------------------------------------------------------------------------------- +RELEASE NOTES: +-------------------------------------------------------------------------------- + +A quick point release, one critical bug fix, and a few new features and +enhancements. Extended the running service from Info: Power: services: to +Network: Info: services:. The PsData refactor makes this quite easy to do. So +why not? + +Also in terms of general usability, added an error handler for options that +require primary options to be meaningful, that was already there for --label and +--uuid, but there are several other similar modifier options that were not +handled. + +-------------------------------------------------------------------------------- +SPECIAL THANKS: + +1. GRAPHICS: Codeberg user malcolmlewis, for being the first to find a fatal bug +(see BUGS 1) in the newly shipped inxi 3.3.32 codebase. Not complex bug, just +stupid coding error. + +2. OPTIONS: mrmazda has been wanting an options handler that tells users when +they use an option that only modifies another, without using the primary option. +That is now working. + +-------------------------------------------------------------------------------- +KNOWN ISSUES: + +1. INFO/NETWORK: Terminology: daemon/service/process: following: +https://serverfault.com/questions/129055/is-there-a-difference-between-a-\ +daemon-and-a-service + +* A "Service" could refer to either a Daemon or a Service. + +* A daemon is a subset of services that always run in memory waiting to service +a request. + +For example, NetworkManager can be started with --no-daemon option, but still +be running as an active service, thus, there is a difference. + +Note that to remove this ambiguity we use the term: services: + +-------------------------------------------------------------------------------- +BUGS: + +1. GRAPHICS: GraphicsItem::map_monitor_ids(): a stray bit of old syntax tripped +an impossible data error. Cause was accidentally make a array index be an index +pointing to an array reference index, leading to failure. Thanks codeberg user +malcolmlewis for triggering this case, which is not super easy to trip. Never +tripped in any recent testing, but valid and a bug. +https://codeberg.org/smxi/inxi/issues/298 + +-------------------------------------------------------------------------------- +FIXES: + +1. DistroData: Removed a stray print debugger. + +-------------------------------------------------------------------------------- +ENHANCEMENTS: + +1. SYSTEM: DistroData: Added final distro/base name cleaners, remove duplicate +'words' that are not numbers from the distro name if they occur in base name. +Also handles a corner case where name and base are the same string, then it +just sets base to empty. Only runs with -Sx and successful name and base +detection. + +2. OPTIONS: Moved and updated these from Output Control section to main options: + +* Added --ip-limit as synonym for --limit so it fits better with --ip. + +* Added --partition-sort, --ps to --partitions-sort, that makes it fit better +with --partition/--partition-full. It only shows --partitions*, but supports +either syntax so it doesn't matter how you remember it. + +* Added new error handler type: arg-modifier which is used to show missing +primary option when primary option modifier is used, like --sleep/-C, +-p/--partitions-sort, -l/-p, and so on. + +3. MACHINE: --uuid/-u now also activates UUID item, like partitions. Keeping +-a adding behavior since we want all that info, but make use of -u consistent +now that using uuid in machine report. Not common though. + +4. NETWORK: -n/-i -a now trip a services: report, with a new line: +Info: services: [services]. These can be daemons or services, same as with Power +services:. + +-------------------------------------------------------------------------------- +CHANGES: + +1a. MAN/OPTIONS: Re-arranged option locations, moved back to their modified +options in primary options. Those didn't fit there, they should have been next +to the options they modify. + +* Moved --partition-sort back up to --partitions [from Output Control sections] + +* Moved --limit to --ip-limit next to --ip [from Output Control sections]. + +1b. MAN/OPTIONS: changed daemons: to services: + +2. INFO: changed Power:... daemons: to services: due to the fact not all +services are daemons, and some potential daemons can be started explicitly with +--no-daemon flag (like NetworkManager), which means it is false to say it's a +daemon. + +-------------------------------------------------------------------------------- +DOCUMENTATION: + +1a. MAN/OPTIONS: See Change 1, moved --partitions-sort, --limit, back up to main +options they modify to make it more readily obvious they belong together. + +2a. DOCS: inxi-battery.txt: updated, added TLP/tlp-stat info. + +2b. DOCS: inxi-network.txt: added DAEMONS tools section. + +-------------------------------------------------------------------------------- +CODE: + +1a. DEBUG: moved the DesktopData::de_wm_debugger() to +main::feature_debugger(). This is a useful tool and will be used for other +complex user data debugging requirements where clear output helps develop and +debug issue. Very useful for --dbg 63 so making general tool. Also used for new +--dbg 66, DistroData, which works in similar way. + +1b. DEBUG: Added to SystemDebugger 'tlp-stat -s', forgot that one. + +1c. DEBUG: Added --dbg 66 for DistroData, like 63 for DesktopData. + +2. SYSTEM: DistroData: refactored to use primary $distro hash ref, this is also +what is passed back to the System line generator now. Switched most variables to +be hash keys, this allows for debugging and tracking what trips the distro data +for --dbg 66, for logging, and to more rapidly check/add/update distro/base IDs. + +3a. CORE: OptionsHandler: small refactor, moved pledge block to set_pledge(), +and moved all option modifier tests to check_modifiers(). This makes it more +obvious each set is its own set of actions, and is easier to maintain. + +3b. CORE: main::error_handler(): new type: arg-modifier: used in 3a. + +3c. CORE: main::make_list_value() replaces main::set_join_sep(), now lists that +can be too long and require a space after separator are generated all by +reference, making for easier and more consistent long value outputs. + +-------------------------------------------------------------------------------- +-- Harald Hope - Tue, 06 Feb 2024 15:16:01 -0800 + +================================================================================ Version: 3.3.32 Patch: 00 Date: 2024-01-30 @@ -673,6 +822,8 @@ DesktopData step by step results, so we know what detected what and how. * --dbg 64: ProgramData::version() print out full version data block. +* --dbg 65: PackageData: print out raw %pms hash. + 5. ERROR HANDLER: Added option-deprecated, option-removed items, for -V, -W, --gpu/--nvidia/--nv type change/remove scenario. @@ -687,7 +838,7 @@ PartitionItem::set_filters to $begin to avoid that pussible clash. filters, like filter-uuid for non partitions. 6c. CORE: Full ps logic refactor: PsData package created, merged in old -set_ps_aux, set_ps_gui and changed them to methods set_cmd and set_de_wm. +set_ps_aux, set_ps_de_wm and changed them to methods set_cmd and set_de_wm. Refactored set_cmd to be much more robust and handle busybox automatically. * Changed global $load{'ps-aux'} to $load{'ps-cmd'} which makes more sense since @@ -723,10 +874,10 @@ to update one set of wm/comp, and had to do loops over and over when all that is required now is the initial searches through @ps_cmd, which is also much shorter, containing only the stuff inxi will need to check. -Now to add a detection, wm, comp, tool, info, dm item, just need to add it in -one place, ps_gui, and there are also no repetitions in there, which there were -before. I expect this will make it much easier and less error prone to add new -items to the various lists. +Now to add a detection, wm, comp, tool, info, dm item, just need to add it in +one place, ps_de_wm, and there are also no repetitions in there, which there +were before. I expect this will make it much easier and less error prone to add +new items to the various lists. * Added PsData::set_dm() to handle fallback dm detection, when none found in /run type directories. Only fires when nothing else found. |