Skip to content

Commit

Permalink
Get rid of last remnants of lsb_release
Browse files Browse the repository at this point in the history
  • Loading branch information
DrHyde committed May 20, 2024
1 parent c48d8a0 commit b896311
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/devuan-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
run: |
cat /etc/os-release
apt-get update
yes|apt-get install perl-base build-essential make gcc lsb-release
yes|apt-get install perl-base build-essential make gcc
yes|perl -MCPAN -e 'install App::cpanminus'
yes|perl -MCPAN -e 'install local::lib'
yes|perl -MCPAN -e 'install Expect'
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/real-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
cat /etc/os-release
mkdir -p /run/systemd/system
apt-get update
yes|apt-get install perl-base build-essential make gcc lsb-release
lsb_release -i
yes|apt-get install perl-base build-essential make gcc
yes|perl -MCPAN -e 'install App::cpanminus'
yes|perl -MCPAN -e 'install local::lib'
yes|perl -MCPAN -e 'install Expect'
Expand Down
9 changes: 7 additions & 2 deletions lib/Devel/AssertOS/Linux/Devuan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ use strict;
use warnings;
no warnings 'redefine';

our $VERSION = '1.0';
use Devel::CheckOS::Helpers::LinuxOSrelease 'distributor_id';

our $VERSION = '1.1';

sub os_is {
my $id = distributor_id;

Devel::CheckOS::os_is('Linux') &&
`lsb_release -i 2>/dev/null` =~ /Devuan/
defined($id) &&
$id eq 'devuan';
}

sub expn { "The operating system is Devuan" }
Expand Down
9 changes: 7 additions & 2 deletions lib/Devel/AssertOS/Linux/Raspbian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ use strict;
use warnings;
no warnings 'redefine';

our $VERSION = '1.0';
use Devel::CheckOS::Helpers::LinuxOSrelease 'distributor_id';

our $VERSION = '1.1';

sub os_is {
my $id = distributor_id;

Devel::CheckOS::os_is('Linux') &&
`lsb_release -i 2>/dev/null` =~ /Raspbian/
defined($id) &&
$id eq 'raspbian';
}

sub expn { "The operating system is some version of Raspbian" }
Expand Down
11 changes: 8 additions & 3 deletions lib/Devel/AssertOS/Linux/RealDebian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ use strict;
use warnings;
no warnings 'redefine';

our $VERSION = '1.0';
use Devel::CheckOS::Helpers::LinuxOSrelease 'distributor_id';

our $VERSION = '1.1';

sub os_is {
my $id = distributor_id;

Devel::CheckOS::os_is('Linux') &&
`lsb_release -i 2>/dev/null` =~ /Debian/
defined($id) &&
$id eq 'debian';
}

sub expn { "The operating system is real Debian, recent enough to have \`lsb_release\`, and not some Debian derivative" }
sub expn { "The operating system is real Debian, recent enough to have \`/etc/os-release\`, and not some Debian derivative" }

Devel::CheckOS::die_unsupported() unless(os_is());

Expand Down
22 changes: 15 additions & 7 deletions lib/Devel/CheckOS/Families.pod
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,30 @@ and user groups. Permissions may not be supported on all filesystems.
This includes both ordinary Linux and Android. Plain old Linux will
match 'Linux'. Android will match both that and 'Android'.

A word of warning - there are a vast number of Linux derivatives, and
I will never detect every single one of them. Most Linux derivatives
will only match 'Linux'.

=head1 THE Linux::Debian FAMILY

Up until version 1.84 this wasn't a family, and would match any platform
which claimed to be Debian via C<lsb_release -i> or on which a file called
C</etc/debian_version> existed. That meant that as well as matching real
Debian, it would also match Ubuntu, Raspbian, and so on. As of version 1.85
C<Linux::Debian> has become a family of all the Debian-based Linuxes. If
C<Linux::Debian> is the family of all the Debian-based Linuxes. If
you want to test which particular family member you're on then look at
C<list_family_members("Linux::Debian")> to see what's available.

NB the difference between C<Linux::RealDebian> (which uses C<lsb_release>
Note the difference between C<Linux::RealDebian> (which uses C</etc/os-release>
for identification) and C<Linux::UnknownDebianLike> (which uses the
existence of C</etc/debian_version> for identification). In particular
beware that some *very* old Debians don't have C<lsb_release> available
beware that some *very* old Debians don't have C</etc/os-release> available
and so will be detected as C<Linux::UnknownDebianLike>.

It is likely that C<Linux::Ubuntu> will in the future turn into a family.

=head1 THE Linux::Redhat and Linux::SUSE FAMILIES

Both Redhat and SUSE come in multiple flavours, some commercial and
some open-source. In particular note that Oracle Linux is a Redhat
derivative.

=head1 THE MicrosoftWindows FAMILY

This includes any version of Windows and also includes things like
Expand Down

0 comments on commit b896311

Please sign in to comment.