From f1fdbd0d60ec9a9a4550b7eac6fd0fb56ee7f640 Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Fri, 17 Nov 2023 19:46:39 -0800 Subject: [PATCH] devuan distro ids, derived, system base --- pinxi | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/pinxi b/pinxi index eeffe7d..4703d2f 100755 --- a/pinxi +++ b/pinxi @@ -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-12'; -my $self_patch='10'; +my $self_date='2023-11-17'; +my $self_patch='11'; ## END INXI INFO ## my ($b_pledge,@pledges); @@ -30952,7 +30952,8 @@ sub get_linux_distro { my $osr_good = 'antergos|chakra|fedora|guix|mageia|manjaro|oracle|pclinuxos|'; $osr_good .= 'porteux|raspberry pi os|slint|zorin'; # Force use of pretty name because that's only location of derived distro name - my $osr_pretty = 'zinc'; + # devuan should catch many devuans spins, which often put their names in pretty + my $osr_pretty = 'devuan|zinc'; my ($b_issue,$b_lsb,$b_osr_pretty,$b_skip_issue,$b_skip_osr); 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 @@ -31248,6 +31249,8 @@ sub system_base { # detect debian steamos before arch steamos my $base_osr_debian_version = '\belive|lmde|neptune|nitrux|parrot|pureos|'; $base_osr_debian_version .= 'rescatux|septor|sparky|steamos|tails'; + my $base_osr_devuan_version = 'crowz|dowse|etertics|\bexe\b|fluxuan|gnuinos|'; + $base_osr_devuan_version .= 'gobmis|heads|miyo|refracta|\bstar\b|virage'; # osr has base ids my $base_default = 'antix-version|bodhi|mx-version'; # base only found in issue @@ -31299,6 +31302,9 @@ sub system_base { elsif (grep {/($base_osr_debian_version)/i} @osr){ $system_base = debian_id(); } + elsif (grep {/($base_osr_devuan_version)/i} @osr){ + $system_base = devuan_id(); + } elsif (grep {/($base_osr_redhat)/i} @osr){ $base_type = 'rhel'; } @@ -31524,6 +31530,9 @@ sub get_os_release { elsif ($base_type eq 'debian' && $base_version){ $distro_osr = debian_id($base_version); } + elsif ($base_type eq 'devuan' && $base_version){ + $distro_osr = devuan_id($base_version); + } } eval $end if $b_log; return $distro_osr; @@ -31604,6 +31613,41 @@ sub debian_id { return $id; } +# args: 0: optional: debian codename +sub devuan_id { + my ($codename) = @_; + my ($devuan_version,$id); + if (-r '/etc/devuan_version'){ + $devuan_version = main::reader('/etc/devuan_version','strip',0); + } + $id = 'Devuan'; + return if !$devuan_version && !$codename; + my %devuans = ( + '1' => 'jesse', # jesse + '2' => 'ascii', # stretch + '3' => 'beowolf', # buster + '4' => 'chimaera', # bullseye + '5' => 'daedalus', # bookworm + '6' => 'excalibur',# trixie + '7' => 'freia', # forky + # '' => 'ceres', # sid/unstable + ); + if (main::is_numeric($devuan_version)){ + $id .= " $devuan_version " . $devuans{int($devuan_version)}; + } + elsif ($codename){ + my %by_value = reverse %devuans; + my $version = (main::is_numeric($devuan_version)) ? "$devuan_version $codename": $devuan_version; + $id .= " $version"; + } + # like ceres/unstable + elsif ($devuan_version){ + $id .= " $devuan_version"; + } + eval $end if $b_log; + return $id; +} + # Note, these are only for matching distro/mint derived names. # Update list as new names become available. While first Mint was 2006-08, # this method depends on /etc/os-release which was introduced 2012-02.