refactor program data ongoing

This commit is contained in:
Harald Hope 2023-12-15 16:05:22 -08:00
parent 9977eb937b
commit ce04449813

216
pinxi
View file

@ -7499,10 +7499,9 @@ sub sound_data {
} }
## Servers ## ## Servers ##
if ($program = main::check_program('artsd')){ if ($program = main::check_program('artsd')){
$name = 'aRts'; ($name,$version) = ProgramData::full('arts',$program);
$status = (grep {/artsd/} @ps_cmd) ? 'active': 'off'; $status = (grep {/artsd/} @ps_cmd) ? 'active': 'off';
$type = 'Server'; $type = 'Server';
$version = ProgramData::version($program,'^artsd',2,'-v',1);
if ($extra > 1){ if ($extra > 1){
$test = [['artswrapper','daemon'],]; $test = [['artswrapper','daemon'],];
$helpers = sound_helpers($test); $helpers = sound_helpers($test);
@ -7517,10 +7516,9 @@ sub sound_data {
# pulseaudio-esound-compat has esd pointing to esdcompat # pulseaudio-esound-compat has esd pointing to esdcompat
if (($program = main::check_program('esd')) && if (($program = main::check_program('esd')) &&
!main::check_program('esdcompat')){ !main::check_program('esdcompat')){
$name = 'EsounD'; ($name,$version) = ProgramData::full('esound',$program);
$status = (grep {/\besd\b/} @ps_cmd) ? 'active': 'off'; $status = (grep {/\besd\b/} @ps_cmd) ? 'active': 'off';
$type = 'Server'; $type = 'Server';
$version = ProgramData::version($program,'^Esound',3,'--version',1,1);
# if ($extra > 1){ # if ($extra > 1){
# $test = [['','daemon'],]; # $test = [['','daemon'],];
# $helpers = sound_helpers($test); # $helpers = sound_helpers($test);
@ -7533,10 +7531,9 @@ sub sound_data {
($status,$version,$helpers,$tools) = ('','',undef,undef); ($status,$version,$helpers,$tools) = ('','',undef,undef);
} }
if ($program = main::check_program('jackd')){ if ($program = main::check_program('jackd')){
$name = 'JACK'; ($name,$version) = ProgramData::full('jack',$program);
$status = jack_status(); $status = jack_status();
$type = 'Server'; $type = 'Server';
$version = ProgramData::version($program,'^jackd',3,'--version',1);
if ($extra > 1){ if ($extra > 1){
$test = [['a2jmidid','daemon'],['nsmd','daemon']]; $test = [['a2jmidid','daemon'],['nsmd','daemon']];
$helpers = sound_helpers($test); $helpers = sound_helpers($test);
@ -7549,10 +7546,9 @@ sub sound_data {
($status,$version,$helpers,$tools) = ('','',undef,undef); ($status,$version,$helpers,$tools) = ('','',undef,undef);
} }
if ($program = main::check_program('nasd')){ if ($program = main::check_program('nasd')){
$name = 'NAS'; ($name,$version) = ProgramData::full('nas',$program);
$status = (grep {/(^|\/)nasd/} @ps_cmd) ? 'active': 'off'; $status = (grep {/(^|\/)nasd/} @ps_cmd) ? 'active': 'off';
$type = 'Server'; $type = 'Server';
$version = ProgramData::version($program,'^Network Audio',5,'-V',1);
if ($extra > 1){ if ($extra > 1){
$test = [['audiooss','oss-compat'],]; $test = [['audiooss','oss-compat'],];
$helpers = sound_helpers($test); $helpers = sound_helpers($test);
@ -7565,10 +7561,9 @@ sub sound_data {
($status,$version,$helpers,$tools) = ('','',undef,undef); ($status,$version,$helpers,$tools) = ('','',undef,undef);
} }
if ($program = main::check_program('pipewire')){ if ($program = main::check_program('pipewire')){
$name = 'PipeWire'; ($name,$version) = ProgramData::full('pipewire',$program);
$status = pipewire_status(); $status = pipewire_status();
$type = 'Server'; $type = 'Server';
$version = ProgramData::version($program,'^Compiled with libpipe',4,'--version',1);
if ($extra > 1){ if ($extra > 1){
# pipewire-alsa is a plugin, but is just some config files # pipewire-alsa is a plugin, but is just some config files
$test = [['pipewire-pulse','daemon'],['pipewire-media-session','daemon'], $test = [['pipewire-pulse','daemon'],['pipewire-media-session','daemon'],
@ -7591,10 +7586,9 @@ sub sound_data {
} }
# note: pactl info/list/stat could be used # note: pactl info/list/stat could be used
if ($program = main::check_program('pulseaudio')){ if ($program = main::check_program('pulseaudio')){
$name = 'PulseAudio'; ($name,$version) = ProgramData::full('pulseaudio',$program);
$status = pulse_status($program); $status = pulse_status($program);
$type = 'Server'; $type = 'Server';
$version = ProgramData::version($program,'^pulseaudio',2,'--version',1);
if ($extra > 1){ if ($extra > 1){
$test = [['pulseaudio-dlna','daemon'], $test = [['pulseaudio-dlna','daemon'],
['pulseaudio-alsa','plugin','/etc/alsa/conf.d/*-pulseaudio-default.conf'], ['pulseaudio-alsa','plugin','/etc/alsa/conf.d/*-pulseaudio-default.conf'],
@ -7610,10 +7604,9 @@ sub sound_data {
($status,$version,$helpers,$tools) = ('','',undef,undef); ($status,$version,$helpers,$tools) = ('','',undef,undef);
} }
if ($program = main::check_program('roard')){ if ($program = main::check_program('roard')){
$name = 'RoarAudio'; ($name,$version) = ProgramData::full('roaraudio',$program);# no version so far
$status = (grep {/roard/} @ps_cmd) ? 'active': 'off'; $status = (grep {/roard/} @ps_cmd) ? 'active': 'off';
$type = 'Server'; $type = 'Server';
# no version so far
if ($extra > 1){ if ($extra > 1){
$test = [['roarplaylistd','daemon'],['roarify','pulse/viff-emulation']]; $test = [['roarplaylistd','daemon'],['roarify','pulse/viff-emulation']];
$helpers = sound_helpers($test); $helpers = sound_helpers($test);
@ -19099,7 +19092,7 @@ sub component_recursive_data {
} }
## MachineItem ## MachineItem
# public subs: get(); is_vm() # public methods: get(), is_vm()
{ {
my $b_vm; my $b_vm;
package MachineItem; package MachineItem;
@ -28304,7 +28297,7 @@ sub version_bsd {
# on earlier BSDs # on earlier BSDs
if (/^kern.compiler_version/){ if (/^kern.compiler_version/){
@working = split(/:\s*/, $_); @working = split(/:\s*/, $_);
$working[1] =~ /.*(gcc|clang)\sversion\s([\S]+)\s.*/; $working[1] =~ /.*(clang|gcc|zigcc)\sversion\s([\S]+)\s.*/;
@$compiler = ($1,$2); @$compiler = ($1,$2);
last; last;
} }
@ -28314,8 +28307,7 @@ sub version_bsd {
# be Clang until way into the future, and it will be the installed version. # be Clang until way into the future, and it will be the installed version.
if (ref $compiler ne 'ARRAY' || !@$compiler){ if (ref $compiler ne 'ARRAY' || !@$compiler){
if (my $path = main::check_program('clang')){ if (my $path = main::check_program('clang')){
$compiler->[0] = 'clang'; ($compiler->[0],$compiler->[1]) = ProgramData::full('clang',$path);
$compiler->[1] =ProgramData::version($path,'clang',3,'--version');
} }
} }
} }
@ -28345,16 +28337,17 @@ sub version_proc {
# $result='Linux version 6.5.0-9-generic (buildd@bos03-amd64-043) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0, GNU ld (GNU Binutils for Ubuntu) 2.41) #9-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 7 01:35:40 UTC 2023'; # $result='Linux version 6.5.0-9-generic (buildd@bos03-amd64-043) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0, GNU ld (GNU Binutils for Ubuntu) 2.41) #9-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 7 01:35:40 UTC 2023';
# $result='Linux version 6.5.13-un-def-alt1 (builder@localhost.localdomain) (gcc-13 (GCC) 13.2.1 20230817 (ALT Sisyphus 13.2.1-alt2), GNU ld (GNU Binutils) 2.41.0.20230826) #1 SMP PREEMPT_DYNAMIC Wed Nov 29 15:54:38 UTC 2023'; # $result='Linux version 6.5.13-un-def-alt1 (builder@localhost.localdomain) (gcc-13 (GCC) 13.2.1 20230817 (ALT Sisyphus 13.2.1-alt2), GNU ld (GNU Binutils) 2.41.0.20230826) #1 SMP PREEMPT_DYNAMIC Wed Nov 29 15:54:38 UTC 2023';
} }
# Note: zigcc is only theoretical, but someone is going to try it!
# cleanest, old style: 'clang version 9.0.0 (' | 'gcc version 7.5.0' # cleanest, old style: 'clang version 9.0.0 (' | 'gcc version 7.5.0'
if ($result =~ /(gcc|clang).*?version\s([^,\s\)]+)/){ if ($result =~ /(gcc|clang|zigcc).*?version\s([^,\s\)]+)/){
@$compiler = ($1,$2); @$compiler = ($1,$2);
} }
# new styles: compiler + stuff + x.y.z. Ignores modifiers to number: -4, -ubuntu # new styles: compiler + stuff + x.y.z. Ignores modifiers to number: -4, -ubuntu
elsif ($result =~ /(gcc|clang).*?\s(\d+(\.\d+){2,4})[)\s,_-]/){ elsif ($result =~ /(gcc|clang|zigcc).*?\s(\d+(\.\d+){2,4})[)\s,_-]/){
@$compiler = ($1,$2); @$compiler = ($1,$2);
} }
# failed, let's at least try for compiler type # failed, let's at least try for compiler type
elsif ($result =~ /(gcc|clang)/){ elsif ($result =~ /(gcc|clang|zigcc)/){
@$compiler = ($1,'N/A'); @$compiler = ($1,'N/A');
} }
} }
@ -30338,7 +30331,7 @@ sub set_gpart_data {
sub get_display_manager { sub get_display_manager {
eval $start if $b_log; eval $start if $b_log;
my (@data,@glob,$link,$path,@temp); my (@glob,$link,$path,@temp);
my $found = []; my $found = [];
# ldm - LTSP display manager. Note that sddm does not appear to have a .pid # ldm - LTSP display manager. Note that sddm does not appear to have a .pid
# extension in Arch. Guessing on cdm, qingy. pcdm uses vt, PCDM-vt9.pid # extension in Arch. Guessing on cdm, qingy. pcdm uses vt, PCDM-vt9.pid
@ -30399,9 +30392,7 @@ sub get_display_manager {
else {$path = $dm} else {$path = $dm}
# print "$path $extra\n"; # print "$path $extra\n";
@dm_info = (); @dm_info = ();
@data = ProgramData::full($dm,$path,3); ($dm_info[0],$dm_info[1]) = ProgramData::full($dm,$path,3);
$dm_info[0] = $data[0];
$dm_info[1] = $data[1];
if (scalar @dms > 1 && (my $temp = ServiceData::get('status',$dm))){ if (scalar @dms > 1 && (my $temp = ServiceData::get('status',$dm))){
$dm_info[2] = message('stopped') if $temp && $temp =~ /stopped|disabled/; $dm_info[2] = message('stopped') if $temp && $temp =~ /stopped|disabled/;
} }
@ -30412,9 +30403,7 @@ sub get_display_manager {
if (@{$ps_data{'dm-active'}}){ if (@{$ps_data{'dm-active'}}){
# ly does not have a run/pid file # ly does not have a run/pid file
if (grep {$_ eq 'ly'} @{$ps_data{'dm-active'}}){ if (grep {$_ eq 'ly'} @{$ps_data{'dm-active'}}){
@data = ProgramData::full('ly','ly',3); ($dm_info[0],$dm_info[1]) = ProgramData::full('ly','ly',3);
$dm_info[0] = $data[0];
$dm_info[1] = $data[1];
$found->[0] = [@dm_info]; $found->[0] = [@dm_info];
} }
elsif (grep {/startx$/} @{$ps_data{'dm-active'}}){ elsif (grep {/startx$/} @{$ps_data{'dm-active'}}){
@ -31431,7 +31420,7 @@ sub get_gcc_data {
return $gccs; return $gccs;
} }
## GlabelData - set/get ## GlabelData: public methods: set(), get()
# Used only to get RAID ZFS gptid path standard name, like ada0p1 # Used only to get RAID ZFS gptid path standard name, like ada0p1
{ {
package GlabelData; package GlabelData;
@ -31513,10 +31502,10 @@ sub get {
if (($comm && $comm =~ /systemd/) || -e '/run/systemd/units'){ if (($comm && $comm =~ /systemd/) || -e '/run/systemd/units'){
$init = 'systemd'; $init = 'systemd';
if ($program = main::check_program('systemd')){ if ($program = main::check_program('systemd')){
$init_version = ProgramData::version($program,'^systemd','2','--version',1); ($init,$init_version) = ProgramData::full('systemd',$program);
} }
if (!$init_version && ($program = main::check_program('systemctl'))){ if (!$init_version && ($program = main::check_program('systemctl'))){
$init_version = ProgramData::version($program,'^systemd','2','--version',1); ($init,$init_version) = ProgramData::full('systemd',$program);
} }
if ($runlevel && $runlevel =~ /^\d$/){ if ($runlevel && $runlevel =~ /^\d$/){
my $target = ''; my $target = '';
@ -31535,20 +31524,15 @@ sub get {
$init = '31init'; $init = '31init';
# no version, this is a 31 line C program # no version, this is a 31 line C program
} }
# epoch version == Epoch Init System 1.0.1 "Sage"
elsif ($comm =~ /epoch/){ elsif ($comm =~ /epoch/){
$init = 'Epoch'; ($init,$init_version) = ProgramData::full('epoch');
$init_version = ProgramData::version('epoch', '^Epoch', '4','version');
} }
# if they fix dinit to show /proc/1/comm == dinit # if they fix dinit to show /proc/1/comm == dinit
elsif ($comm =~ /^dinit/){ elsif ($comm =~ /^dinit/){
dinit_data(); ($init,$init_version) = ProgramData::full('dinit');
} }
elsif ($comm =~ /finit/){ elsif ($comm =~ /finit/){
$init = 'finit'; ($init,$init_version) = ProgramData::full('finit');
if ($program = main::check_program('finit')){
$init_version = ProgramData::version($program,'^Finit','2','-v',1);
}
} }
# not verified # not verified
elsif ($comm =~ /^hummingbird/){ elsif ($comm =~ /^hummingbird/){
@ -31572,25 +31556,31 @@ sub get {
# no version data as of 2022-10-26 # no version data as of 2022-10-26
} }
elsif ($comm =~ /shepherd/){ elsif ($comm =~ /shepherd/){
$init = 'Shepherd'; ($init,$init_version) = ProgramData::full('shepherd');
$init_version = ProgramData::version('shepherd', '^shepherd', '4','--version',1);
} }
# fallback for some inits that link to /sbin/init # fallback for some inits that link to /sbin/init
elsif ($comm eq 'init'){ elsif ($comm eq 'init'){
# shows /sbin/dinit-init but may change # shows /sbin/dinit-init but may change
if (-e '/sbin/dinit' && $link && $link =~ /dinit/){ if (-e '/sbin/dinit' && $link && $link =~ /dinit/){
dinit_data(); ($init,$init_version) = ProgramData::full('dinit');
} }
elsif (-e '/sbin/openrc-init' && $link && $link =~ /openrc/){ elsif (-e '/sbin/openrc-init' && $link && $link =~ /openrc/){
($init,$init_version) = openrc_data(); $init = 'OpenRc';
# /sbin/openrc --version: openrc (OpenRC) 0.13
if ($program = main::check_program('openrc')){
($init,$init_version) = ProgramData::full('openrc',$program);
}
# /sbin/rc --version: rc (OpenRC) 0.11.8 (Gentoo Linux)
elsif ($program = main::check_program('rc')){
($init,$init_version) = ProgramData::full('rc',$program);
}
} }
} }
} }
if (!$init){ if (!$init){
# openwrt/busybox /sbin/init hangs on --version command # openwrt/busybox /sbin/init hangs on --version command
if (-e '/sbin/init' && $link && $link =~ /busybox/){ if (-e '/sbin/init' && $link && $link =~ /busybox/){
$init_version = ProgramData::version('init', 'busybox', '2','--help',1,1); ($init,$init_version) = ProgramData::full('busybox','/sbin/init');
$init = 'BusyBox';
} }
# risky since we don't know which init it is. $comm == 'init' # risky since we don't know which init it is. $comm == 'init'
# output: /sbin/init --version: init (upstart 1.1); init (upstart 0.6.3) # output: /sbin/init --version: init (upstart 1.1); init (upstart 0.6.3)
@ -31639,32 +31629,6 @@ sub get {
}; };
} }
sub dinit_data {
eval $start if $b_log;
$init = 'dinit';
# Dinit version 0.15.1.
if ($program = main::check_program('dinit')){
$init_version = ProgramData::version($program,'^Dinit','3','--version',1);
$init_version =~ s/\.$//;
}
eval $end if $b_log;
}
sub openrc_data {
eval $start if $b_log;
my $version;
# /sbin/openrc --version == openrc (OpenRC) 0.13
if ($program = main::check_program('openrc')){
$version = ProgramData::version($program, '^openrc', '3','--version');
}
# /sbin/rc --version == rc (OpenRC) 0.11.8 (Gentoo Linux)
elsif ($program = main::check_program('rc')){
$version = ProgramData::version($program, '^rc', '3','--version');
}
eval $end if $b_log;
return ('OpenRC',$version);
}
# Check? /var/run/nologin for bsds? # Check? /var/run/nologin for bsds?
sub get_runlevel { sub get_runlevel {
eval $start if $b_log; eval $start if $b_log;
@ -31996,7 +31960,7 @@ sub parameters_bsd {
} }
} }
## LsblkData - set/get ## LsblkData: public methods: set(), get()
{ {
package LsblkData; package LsblkData;
@ -33702,7 +33666,7 @@ sub _round {
} }
} }
## PartitionData - set/get ## PartitionData: public methods: set(), get()
# for /proc/partitions only, see DiskDataBSD for BSD partition data. # for /proc/partitions only, see DiskDataBSD for BSD partition data.
{ {
package PartitionData; package PartitionData;
@ -33849,7 +33813,7 @@ sub get_pcie_data {
eval $end if $b_log; eval $end if $b_log;
} }
## PowerData - get ## PowerData: public method: get()
# No BSD support currently. Test by !$bsd_type. Should any BSD data source # No BSD support currently. Test by !$bsd_type. Should any BSD data source
# appear, make bsd_data() and add $bsd_type switch here, remove from caller. # appear, make bsd_data() and add $bsd_type switch here, remove from caller.
{ {
@ -33914,15 +33878,16 @@ sub sys_data {
} }
# ProgramData # ProgramData
# public subs: # public methods:
# full() - returns (print name, version nu). # full(): returns (print name, version nu).
# values() - returns program values array # values(): returns program values array
# version() - returns program version number # version(): returns program version number
{ {
package ProgramData; package ProgramData;
# returns array of: 0: program print name 1: program version # returns array of: 0: program print name 1: program version
# args: 0: program values ID; 1: program version string; # args: 0: program values ID [usually program name];
# 1: program alternate name, or path [allows for running different command];
# 2: $extra level. Note that StartClient runs BEFORE -x levels are set! # 2: $extra level. Note that StartClient runs BEFORE -x levels are set!
# Only use this function when you only need the name/version data returned # Only use this function when you only need the name/version data returned
sub full { sub full {
@ -33950,11 +33915,11 @@ sub full {
# It's almost 1000 times slower to load these each time values() is called!! # It's almost 1000 times slower to load these each time values() is called!!
# %program_values: key: desktop/app command for --version => [0: search string; # %program_values: key: desktop/app command for --version => [0: search string;
# 1: space print number; 2: [optional] version arg: -v, version, etc; # 1: space print number; 2: [optional] version arg: -v, version, etc;
# 3: print name; 4: console 0/1; 5: [optional] exit first find 0/1; # 3: print name; 4: console 0/1; 5: [optional] exit first line 0/1;
# 6: [optional] 0/1 stderr output; 7: replace regex; 8: extra data] # 6: [optional] 0/1 stderr output; 7: replace regex; 8: extra data]
sub set_values { sub set_values {
%program_values = ( %program_values = (
## Clients ## ## Clients (IRC,chat) ##
'bitchx' => ['bitchx',2,'','BitchX',1,0,0,'',''],# special 'bitchx' => ['bitchx',2,'','BitchX',1,0,0,'',''],# special
'finch' => ['finch',2,'-v','Finch',1,1,0,'',''], 'finch' => ['finch',2,'-v','Finch',1,1,0,'',''],
'gaim' => ['[0-9.]+',2,'-v','Gaim',0,1,0,'',''], 'gaim' => ['[0-9.]+',2,'-v','Gaim',0,1,0,'',''],
@ -33975,6 +33940,11 @@ sub set_values {
'weechat-curses' => ['[0-9.]+',1,'-v','WeeChat',1,0,0,'',''], 'weechat-curses' => ['[0-9.]+',1,'-v','WeeChat',1,0,0,'',''],
'xchat-gnome' => ['[0-9.]+',2,'-v','X-Chat-Gnome',1,1,0,'',''], 'xchat-gnome' => ['[0-9.]+',2,'-v','X-Chat-Gnome',1,1,0,'',''],
'xchat' => ['[0-9.]+',2,'-v','X-Chat',1,1,0,'',''], 'xchat' => ['[0-9.]+',2,'-v','X-Chat',1,1,0,'',''],
## Compilers ##
'clang' => ['clang',3,'--version','clang',1,1,0,'',''],
'gcc' => ['^gcc',3,'--version','GCC',1,0,0,'',''], # not used due to inconsistent syntax
'gcc-apple' => ['Apple[[:space:]]LLVM',2,'--version','LLVM',1,0,0,'',''], # not used
'zigcc' => ['zigcc',0,'0','zigcc',1,1,0,'',''], # unverified
## Desktops / wm / compositors ## ## Desktops / wm / compositors ##
'2bwm' => ['^2bwm',0,'0','2bWM',0,1,0,'',''], # unverified/based on mcwm '2bwm' => ['^2bwm',0,'0','2bWM',0,1,0,'',''], # unverified/based on mcwm
'3dwm' => ['^3dwm',0,'0','3Dwm',0,1,0,'',''], # unverified '3dwm' => ['^3dwm',0,'0','3Dwm',0,1,0,'',''], # unverified
@ -34106,6 +34076,7 @@ sub set_values {
'muffin' => ['^muffin',2,'--version','Muffin',0,1,0,'',''], 'muffin' => ['^muffin',2,'--version','Muffin',0,1,0,'',''],
'musca' => ['^musca',0,'-v','Musca',0,1,0,'',''], # unverified 'musca' => ['^musca',0,'-v','Musca',0,1,0,'',''], # unverified
'mutter' => ['^mutter',2,'--version','Mutter',0,1,0,'',''], 'mutter' => ['^mutter',2,'--version','Mutter',0,1,0,'',''],
'mvwm' => ['^mvwm',0,'0','mvwm',0,1,0,'',''], # unverified
'mwm' => ['^mwm',0,'0','MWM',0,1,0,'',''],# no version 'mwm' => ['^mwm',0,'0','MWM',0,1,0,'',''],# no version
'nawm' => ['^nawm',0,'0','nawm',0,1,0,'',''],# unverified 'nawm' => ['^nawm',0,'0','nawm',0,1,0,'',''],# unverified
'newm' => ['^newm',0,'0','newm',0,1,0,'',''], # unverified 'newm' => ['^newm',0,'0','newm',0,1,0,'',''], # unverified
@ -34204,10 +34175,6 @@ sub set_values {
'xmonad' => ['^xmonad',2,'--version','XMonad',0,1,0,'',''], 'xmonad' => ['^xmonad',2,'--version','XMonad',0,1,0,'',''],
'xuake' => ['^xuake',0,'0','xuake',0,1,0,'',''], # unverified 'xuake' => ['^xuake',0,'0','xuake',0,1,0,'',''], # unverified
'yeahwm' => ['^yeahwm',0,'--version','YeahWM',0,1,0,'',''], # unverified 'yeahwm' => ['^yeahwm',0,'--version','YeahWM',0,1,0,'',''], # unverified
## Toolkits ##
'gtk-launch' => ['^\S',1,'--version','GTK',0,1,0,'',''],
'qmake' => ['^^Using Qt version',4,'--version','Qt',0,0,0,'',''],
'qtdiag' => ['^qt',2,'--version','Qt',0,1,0,'',''],
## Display Managers (dm) ## ## Display Managers (dm) ##
'brzdm' => ['^brzdm version',3,'-v','brzdm',0,1,0,'',''], # unverified, slim fork 'brzdm' => ['^brzdm version',3,'-v','brzdm',0,1,0,'',''], # unverified, slim fork
'cdm' => ['^cdm',0,'0','CDM',0,1,0,'',''], 'cdm' => ['^cdm',0,'0','CDM',0,1,0,'',''],
@ -34244,6 +34211,20 @@ sub set_values {
'xdmctl' => ['^xdm',0,'0','XDM',0,1,0,'',''],# opensuse/redhat may use this to start real dm 'xdmctl' => ['^xdm',0,'0','XDM',0,1,0,'',''],# opensuse/redhat may use this to start real dm
'xenodm' => ['^xenodm',0,'0','xenodm',0,1,0,'',''], 'xenodm' => ['^xenodm',0,'0','xenodm',0,1,0,'',''],
'xlogin' => ['^xlogin',0,'-V','xlogin',0,1,0,'',''], # unverified, probably clogin 'xlogin' => ['^xlogin',0,'-V','xlogin',0,1,0,'',''], # unverified, probably clogin
## Init ##
'busybox' => ['busybox',2,'--help','BusyBox',0,1,1,'',''],
# Dinit version 0.15.1. [ends .]
'dinit' => ['^Dinit',3,'--version','Dinit',0,1,0,'',''],
# version: Epoch Init System 1.0.1 "Sage"
'epoch' => ['^Epoch',4,'version','Epoch',0,1,0,'',''],
'finit' => ['^Finit',2,'-v','finit',0,1,0,'',''],
# /sbin/openrc --version: openrc (OpenRC) 0.13
'openrc' => ['^openrc',3,'--version','OpenRC',0,1,0,'',''],
# /sbin/rc --version: rc (OpenRC) 0.11.8 (Gentoo Linux)
'rc' => ['^rc',3,'--version','OpenRC',0,1,0,'',''],
'shepherd' => ['^shepherd',4,'--version','Shepherd',0,1,0,'',''],
'systemd' => ['^systemd',2,'--version','systemd',0,1,0,'',''],
'upstart' => ['upstart',3,'--version','Upstart',0,1,0,'',''],
## Shells - not checked: ion, eshell ## ## Shells - not checked: ion, eshell ##
## See ShellData::shell_test() for unhandled but known shells ## See ShellData::shell_test() for unhandled but known shells
'ash' => ['',3,'pkg','ash',1,0,0,'',''], # special; dash precursor 'ash' => ['',3,'pkg','ash',1,0,0,'',''], # special; dash precursor
@ -34271,10 +34252,19 @@ sub set_values {
'xonsh' => ['^xonsh',1,'--version','xonsh',1,0,0,'^xonsh[\/-]',''], 'xonsh' => ['^xonsh',1,'--version','xonsh',1,0,0,'^xonsh[\/-]',''],
'yash' => ['^Y',5,'--version','yash',1,0,0,'',''], 'yash' => ['^Y',5,'--version','yash',1,0,0,'',''],
'zsh' => ['^zsh',2,'--version','Zsh',1,0,0,'',''], 'zsh' => ['^zsh',2,'--version','Zsh',1,0,0,'',''],
## Sound Servers ##
'arts' => ['^artsd',2,'-v','aRts',0,1,0,'',''],
'esound' => ['^Esound',3,'--version','EsounD',0,1,1,'',''],
'jack' => ['^jackd',3,'--version','JACK',0,1,0,'',''],
'nas' => ['^Network Audio',5,'-V','NAS',0,1,0,'',''],
'pipewire' => ['^Compiled with libpipe',4,'--version','PipeWire',0,1,0,'',''],
'pulseaudio' => ['^pulseaudio',2,'--version','PulseAudio',0,1,0,'',''],
'roaraudio' => ['^roaraudio',0,'0','RoarAudio',0,1,0,'',''], # no version/unknown?
## Toolkits ##
'gtk-launch' => ['^\S',1,'--version','GTK',0,1,0,'',''],
'qmake' => ['^^Using Qt version',4,'--version','Qt',0,0,0,'',''],
'qtdiag' => ['^qt',2,'--version','Qt',0,1,0,'',''],
## Tools ## ## Tools ##
'clang' => ['clang',3,'--version','Clang',1,0,0,'',''],
'gcc' => ['^gcc',3,'--version','GCC',1,0,0,'',''],
'gcc-apple' => ['Apple[[:space:]]LLVM',2,'--version','LLVM',1,0,0,'',''],
'sudo' => ['^Sudo',3,'-V','Sudo',1,1,0,'',''], # sudo pre 1.7 does not have --version 'sudo' => ['^Sudo',3,'-V','Sudo',1,1,0,'',''], # sudo pre 1.7 does not have --version
); );
} }
@ -34288,11 +34278,10 @@ sub set_values {
# note: setting index 1 or 2 to 0 will trip flags to not do version # note: setting index 1 or 2 to 0 will trip flags to not do version
# args: 0: program lower case name # args: 0: program lower case name
sub values { sub values {
my $app = $_[0];
my @values; my @values;
ProgramData::set_values() if !%program_values; ProgramData::set_values() if !%program_values;
if (defined $program_values{$app}){ if (defined $program_values{$_[0]}){
@values = @{$program_values{$app}}; @values = @{$program_values{$_[0]}};
} }
# my $debug = Dumper \@values; # my $debug = Dumper \@values;
main::log_data('dump','@values',\@values) if $b_log; main::log_data('dump','@values',\@values) if $b_log;
@ -34377,9 +34366,10 @@ sub version {
# breaks version detection. A quick fix attempt is to just add 1 to $num # breaks version detection. A quick fix attempt is to just add 1 to $num
# to get the next value. # to get the next value.
$version_nu = $data[$num+1] if $data[$num+1] && $version_nu =~ /version/i; $version_nu = $data[$num+1] if $data[$num+1] && $version_nu =~ /version/i;
$version_nu =~ s/(\([^)]+\)|,|"|\||\(|\))//g if $version_nu; $version_nu =~ s/(\([^)]+\)|,|"|\||\(|\)|\.$)//g if $version_nu;
# trim off leading v but only when followed by a number # trim off leading v but only when followed by a number
$version_nu =~ s/^v([0-9])/$1/i if $version_nu; $version_nu =~ s/^v([0-9])/$1/i if $version_nu;
# print "$version_nu\n"; # print "$version_nu\n";
last; last;
} }
@ -34438,7 +34428,10 @@ sub version_pkg {
} }
## PsData ## PsData
# public subs: set_cmd(); set_gui() # public methods:
# set_cmd(): sets @ps_aux, @ps_cmd
# set_dm(): sets $ps_data{'dm-active'}
# set_gui(): sets @ps_gui and $ps_data items
{ {
package PsData; package PsData;
@ -34476,8 +34469,8 @@ sub set_cmd {
# we want more data from ps busybox, to get TinyX screen res # we want more data from ps busybox, to get TinyX screen res
my $cols_use = ($b_busybox) ? 7 : 2; my $cols_use = ($b_busybox) ? 7 : 2;
my $pattern = 'apache|brave|chrom(e|ium)|falkon|(fire|water)fox|gvfs|http|'; my $pattern = 'apache|brave|chrom(e|ium)|falkon|(fire|water)fox|gvfs|http|';
$pattern .= 'konqueror|mariadb|mysql|openvpn|opera|pale|postgre|php|'; $pattern .= 'konqueror|mariadb|midori|mysql|nfsd|nginx|openvpn|opera|';
$pattern .= 'qtwebengine|smbd|smtp|sssd|vivald'; $pattern .= 'pale|postgre|php|qtwebengine|smbd|smtp|sssd|vivald';
for (@$ps){ for (@$ps){
next if !$_; next if !$_;
next if $self_name eq 'inxi' && /\/$self_name\b/; next if $self_name eq 'inxi' && /\/$self_name\b/;
@ -34497,12 +34490,13 @@ sub set_cmd {
push(@ps_cmd,join(' ', @split[$ps_data{'header'}->[0] .. $final])); push(@ps_cmd,join(' ', @split[$ps_data{'header'}->[0] .. $final]));
} }
} }
# never prints with 5, because ps loaded before option handler # dump multiple instances, just need to see if process running
# print 'ps main: ', Data::Dumper::Dumper \@ps_cmd; # if $dbg[5]; main::uniq(\@ps_cmd) if @ps_cmd;
# Use $dbg[61] to see @ps_cmd result
eval $end if $b_log; eval $end if $b_log;
} }
# only runs when no dm found # only runs when no /run type dm found
sub set_dm { sub set_dm {
eval $start if $b_log; eval $start if $b_log;
# startx: /bin/sh /usr/bin/startx # startx: /bin/sh /usr/bin/startx
@ -36477,10 +36471,11 @@ sub generate {
main::set_dboot_data() if $bsd_type && !$loaded{'dboot'}; main::set_dboot_data() if $bsd_type && !$loaded{'dboot'};
# note: ps aux loads before logging starts, so create debugger data here # note: ps aux loads before logging starts, so create debugger data here
if ($b_log){ if ($b_log){
# I don't think we need to see this, it's long, but leave in case we do # With logging, we already get ps wwwaux so no need to get it again here
# main::log_data('dump','@ps_aux',\@ps_aux); # main::log_data('dump','@ps_aux',\@ps_aux);
main::log_data('dump','@ps_cmd',\@ps_cmd); main::log_data('dump','@ps_cmd',\@ps_cmd);
} }
print Data::Dumper::Dumper \@ps_cmd if $dbg[61];
if ($show{'short'}){ if ($show{'short'}){
$item = short_output(); $item = short_output();
assign_data($item); assign_data($item);
@ -36788,7 +36783,7 @@ sub info_item {
} }
} }
if ($extra > 0){ if ($extra > 0){
my ($b_clang,$b_gcc,$gcc,$gcc_alt); my ($b_gcc,$clang,$clang_version,$gcc,$gcc_alt,$path,$zigcc,$zigcc_version);
my $gccs = main::get_gcc_data(); my $gccs = main::get_gcc_data();
if (@$gccs){ if (@$gccs){
$gcc = shift @$gccs; $gcc = shift @$gccs;
@ -36798,22 +36793,27 @@ sub info_item {
$b_gcc = 1; $b_gcc = 1;
$gcc ||= 'N/A'; # should not be needed after fix but leave in case undef $gcc ||= 'N/A'; # should not be needed after fix but leave in case undef
} }
my $clang_version = ''; if ($path = main::check_program('clang')){
if (my $path = main::check_program('clang')){ ($clang,$clang_version) = ProgramData::full('clang',$path);
$clang_version = ProgramData::version($path,'clang',3,'--version');
$clang_version ||= 'N/A';
$b_clang = 1;
} }
my $compiler = ($b_gcc || $b_clang) ? '': 'N/A'; if ($path = main::check_program('zigcc')){
($zigcc,$zigcc_version) = ProgramData::full('zigcc',$path);
}
my $compiler = ($b_gcc || $clang || $zigcc) ? '': 'N/A';
$data->{$data_name}[$index]{main::key($num++,1,1,'Compilers')} = $compiler; $data->{$data_name}[$index]{main::key($num++,1,1,'Compilers')} = $compiler;
if ($clang){
$clang_version ||= 'N/A';
$data->{$data_name}[$index]{main::key($num++,0,2,'clang')} = $clang_version;
}
if ($b_gcc){ if ($b_gcc){
$data->{$data_name}[$index]{main::key($num++,1,2,'gcc')} = $gcc; $data->{$data_name}[$index]{main::key($num++,1,2,'gcc')} = $gcc;
if ($extra > 1 && $gcc_alt){ if ($extra > 1 && $gcc_alt){
$data->{$data_name}[$index]{main::key($num++,0,3,'alt')} = $gcc_alt; $data->{$data_name}[$index]{main::key($num++,0,3,'alt')} = $gcc_alt;
} }
} }
if ($b_clang){ if ($zigcc){
$data->{$data_name}[$index]{main::key($num++,0,2,'clang')} = $clang_version; $zigcc_version ||= 'N/A';
$data->{$data_name}[$index]{main::key($num++,0,2,'zigcc')} = $zigcc_version;
} }
} }
# $index++ if $extra > 1 && !$loaded{'shell-data'}; # $index++ if $extra > 1 && !$loaded{'shell-data'};