Skip to content

Commit

Permalink
add support for Devuan
Browse files Browse the repository at this point in the history
  • Loading branch information
DrHyde committed May 24, 2021
1 parent 7f8315f commit fcd6cfb
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -1,3 +1,7 @@
1.87 2021-XX-XX

- Add support for Devuan Linux

1.86 2021-05-20

- Belatedly add doco on Debian family to Families.pod
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -117,3 +117,4 @@ t/pod.t
t/script.t
t/unknown-debian.t
lib/Devel/AssertOS/MacOSX/v11.pm
lib/Devel/AssertOS/Linux/Devuan.pm
6 changes: 3 additions & 3 deletions lib/Devel/AssertOS/Linux/Debian.pm
Expand Up @@ -5,9 +5,9 @@ use strict;
use warnings;
no warnings 'redefine';

our $VERSION = '1.1';
our $VERSION = '1.2';

sub matches { map { "Linux::$_" } qw(Raspbian Ubuntu RealDebian UnknownDebianLike) }
sub matches { map { "Linux::$_" } qw(Raspbian Ubuntu RealDebian UnknownDebianLike Devuan) }

sub os_is { Devel::CheckOS::os_is(matches()) }

Expand All @@ -17,7 +17,7 @@ Devel::CheckOS::die_unsupported() unless(os_is());

=head1 COPYRIGHT and LICENCE
Copyright 2007 - 2020 David Cantrell
Copyright 2007 - 2021 David Cantrell
This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
Expand Down
28 changes: 28 additions & 0 deletions lib/Devel/AssertOS/Linux/Devuan.pm
@@ -0,0 +1,28 @@
package Devel::AssertOS::Linux::Devuan;

use Devel::CheckOS;
use strict;
use warnings;
no warnings 'redefine';

our $VERSION = '1.0';

sub os_is {
Devel::CheckOS::os_is('Linux') &&
`lsb_release -i 2>/dev/null` =~ /Devuan/
}

sub expn { "The operating system is Devuan" }

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

=head1 COPYRIGHT and LICENCE
Copyright 2007 - 2021 David Cantrell
This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
=cut

1;

2 changes: 1 addition & 1 deletion lib/Devel/CheckOS.pm
Expand Up @@ -6,7 +6,7 @@ use Exporter;

use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS);

our $VERSION = '1.86';
our $VERSION = '1.87';

@ISA = qw(Exporter);
@EXPORT_OK = qw(os_is os_isnt die_if_os_is die_if_os_isnt die_unsupported list_platforms list_family_members);
Expand Down
16 changes: 7 additions & 9 deletions t/unknown-debian.t
Expand Up @@ -2,16 +2,14 @@ use strict;
use warnings;

use Test::More;
plan skip_all => "This isn't Debian-ish" unless os_is('Linux::Debian');

use Devel::CheckOS qw(os_is);
use Devel::CheckOS qw(os_is list_family_members);

SKIP: {
skip "This isn't Debian-ish", 1 unless os_is('Debian');
ok(
(os_is(map { "Linux::$_" } qw(Raspbian Ubuntu RealDebian)) ? 1 : 0) +
(os_is('Linux::UnknownDebianLike') ? 1 : 0) == 1,
"OS isn't both UnknownDebianLike and some known Debian variant"
);
}
ok(
(os_is(grep { $_ ne 'Linux::UnknownDebianLike' } list_family_members('Linux::Debian')) ? 1 : 0) +
(os_is('Linux::UnknownDebianLike') ? 1 : 0) == 1,
"OS isn't both UnknownDebianLike and some known Debian variant"
);

done_testing();

0 comments on commit fcd6cfb

Please sign in to comment.