added debian/ubuntu spin detections

This commit is contained in:
Harald Hope 2023-11-05 19:09:44 -08:00
parent c667a01092
commit e8ac808fcd

51
pinxi
View file

@ -50,8 +50,8 @@ use POSIX qw(ceil uname strftime ttyname);
## INXI INFO ##
my $self_name='pinxi';
my $self_version='3.3.31';
my $self_date='2023-11-02';
my $self_patch='02';
my $self_date='2023-11-05';
my $self_patch='03';
## END INXI INFO ##
my ($b_pledge,@pledges);
@ -17416,6 +17416,7 @@ sub xrandr_data {
my ($res_x,$res_x_max,$res_y,$res_y_max);
my ($screen_id,$set_as,$size_x,$size_x_i,$size_y,$size_y_i);
my (@ids,%monitors,@xrandr_screens,$xrandr);
# note: --prop support added v 1.2, ~2009 in distros
if (!$fake{'xrandr'}){
$xrandr = main::grabber("$program $display_opt 2>/dev/null",'','strip','ref');
}
@ -18673,7 +18674,7 @@ sub set_monitors_sys {
eval $start if $b_log;
my $pattern = '/sys/class/drm/card[0-9]/device/driver/module/drivers/*';
my @cards_glob = main::globber($pattern);
$pattern = '/sys/class/drm/card*-*/{edid,enabled,status,modes}';
$pattern = '/sys/class/drm/card*-*/{connector_id,edid,enabled,status,modes}';
my @ports_glob = main::globber($pattern);
# print Data::Dumper::Dumper \@cards_glob;
# print Data::Dumper::Dumper \@ports_glob;
@ -18707,6 +18708,9 @@ sub set_monitors_sys {
# print "$file\n";
$monitor_ids->{$port}{$item} = main::reader($file,'strip',0);
}
elsif ($item eq 'connector_id'){
$monitor_ids->{$port}{'connector-id'} = main::reader($file,'strip',0);
}
# arm: U:1680x1050p-0
elsif ($item eq 'modes'){
@data = main::reader($file,'strip');
@ -31113,6 +31117,15 @@ sub get_linux_distro {
elsif (-d '/etc/salixtools/' && $distro =~ /Slackware/i){
$distro =~ s/Slackware/Salix/;
}
# check for spins
elsif ($distro =~ /^(Debian|Ubuntu)/i){
my $base = $1;
my $temp = distro_spin($distro);
if ($temp ne $distro){
$system_base = $base if !$system_base && $extra > 0;
$distro = $temp;
}
}
}
else {
# android fallback, sometimes requires root, sometimes doesn't
@ -31548,6 +31561,38 @@ sub ubuntu_id {
eval $end if $b_log;
return $id;
}
sub distro_spin {
my $name = $_[0];
eval $start if $b_log;
my @spins = (
['budgie','budgie','Ubuntu Budgie','Ubuntu'],
['cinnamon','cinnamon','Ubuntu Cinnamon','Ubuntu'],
['edubuntu','edubuntu','Edubuntu','Ubuntu'],
['icebox','icebox','Debian Icebox','Debian'],
['kubuntu','plasma','Kubuntu','Ubuntu'],
['kylin','kylin','Ubuntu Kylin','Ubuntu'],
['lubuntu','lubuntu','Lubuntu','Ubuntu'],
['mate','mate','Ubuntu MATE','Ubuntu'],
['studio','studio','Ubuntu Studio','Ubuntu'],
['xebian','xebian','Xebian','Debian'],
['xubuntu','xubuntu','Xubuntu','Ubuntu'],
);
my $tests = 'budgie,cinna,edub,plasma,kylin,lubu,mate,studio,xebi,xubu';
$tests = join(':',
main::globber("/etc/xdg/xdg-*{$tests}*"));
# xdg is poor since only works in gui
foreach my $spin (@spins){
if ($name !~ /$spin->[0]/i && (
($ENV{'XDG_CONFIG_DIRS'} && $ENV{'XDG_CONFIG_DIRS'} =~ /$spin->[1]/i) ||
($tests && $tests =~ /$spin->[1]/i))){
$name =~ s/\b$spin->[3]/$spin->[2]/i;
last;
}
}
eval $end if $b_log;
return $name;
}
}
## DmidecodeData