Skip to content

Commit

Permalink
Detect Slackware
Browse files Browse the repository at this point in the history
  • Loading branch information
giterlizzi committed Dec 15, 2024
1 parent d79cd84 commit 11f96bd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Rex/Hardware/Host.pm
Original file line number Diff line number Diff line change
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 11f96bd

Please sign in to comment.