Skip to content

Commit

Permalink
Detect Slackware
Browse files Browse the repository at this point in the history
  • Loading branch information
giterlizzi authored Dec 15, 2024
1 parent 38a0742 commit 94511de
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/Rex/Hardware/Host.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package Rex::Hardware::Host;
use v5.12.5;
use warnings;

our $VERSION = '9999.99.99_99'; # VERSION
our $VERSION = '1.15.0'; # VERSION

use English qw(-no_match_vars);
use Rex;
Expand Down Expand Up @@ -117,6 +117,9 @@ sub get_operating_system {
elsif ( $ret eq "ManjaroLinux" ) {
$ret = "Manjaro";
}
elsif ( $ret =~ m/Slackware/i ) {
$ret = "Slackware";
}
return $ret;
}
}
Expand Down Expand Up @@ -187,6 +190,10 @@ sub get_operating_system {
return "Manjaro";
}

if ( is_file("/etc/slackware-version") ) {
return "Slackware";
}

my $os_string = i_run("uname -s");
return $os_string; # return the plain os

Expand Down Expand Up @@ -339,6 +346,17 @@ sub get_operating_system_version {
return $version;
}
}
elsif ( $op eq 'Slackware' ) {
my $fh = file_read("/etc/slackware-version");
my $content = $fh->read_all;
$fh->close;

chomp $content;

$content =~ m/(\d+(\.[\d+]+)*)/;

return $1;
}

return [ i_run("uname -r") ]->[0];

Expand Down

0 comments on commit 94511de

Please sign in to comment.