Skip to content

Commit 11f96bd

Browse files
committed
Detect Slackware
1 parent d79cd84 commit 11f96bd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/Rex/Hardware/Host.pm

+18
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ sub get_operating_system {
117117
elsif ( $ret eq "ManjaroLinux" ) {
118118
$ret = "Manjaro";
119119
}
120+
elsif ( $ret =~ m/Slackware/i ) {
121+
$ret = "Slackware";
122+
}
120123
return $ret;
121124
}
122125
}
@@ -187,6 +190,10 @@ sub get_operating_system {
187190
return "Manjaro";
188191
}
189192

193+
if ( is_file("/etc/slackware-version") ) {
194+
return "Slackware";
195+
}
196+
190197
my $os_string = i_run("uname -s");
191198
return $os_string; # return the plain os
192199

@@ -339,6 +346,17 @@ sub get_operating_system_version {
339346
return $version;
340347
}
341348
}
349+
elsif ( $op eq 'Slackware' ) {
350+
my $fh = file_read("/etc/slackware-version");
351+
my $content = $fh->read_all;
352+
$fh->close;
353+
354+
chomp $content;
355+
356+
$content =~ m/(\d+(\.[\d+]+)*)/;
357+
358+
return $1;
359+
}
342360

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

0 commit comments

Comments
 (0)