Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.143.253.165
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : BSD.pm
package Ocsinventory::Agent::Backend::OS::BSD;

use strict;

use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];

sub check { $^O =~ /freebsd|openbsd|netbsd|gnukfreebsd|gnuknetbsd/ }

sub run {
    my $params = shift;
    my $common = $params->{common};
  
    my $OSName;
    my $OSComment;
    my $OSVersion;
    my $OSLevel;
    my $OSArchi;
  
    # Operating system informations
    chomp($OSName=`uname -s`);
    chomp($OSVersion=`uname -r`);
    chomp($OSArchi=`uname -p`);
  
    # Retrieve the origin of the kernel configuration file
    my ($date, $origin, $kernconf);
    for (`sysctl -n kern.version`) {
        $date = $1 if /^\S.*\#\d+:\s*(.*)/;
        ($origin,$kernconf) = ($1,$2) if /^\s+(.+):(.+)$/;
    }
    $kernconf =~ s/\/.*\///; # remove the path
    $OSComment = $kernconf." (".$date.")\n".$origin;
    # if there is a problem use uname -v
    chomp($OSComment=`uname -v`) unless $OSComment; 
    
    $common->setHardware({
        OSNAME => $OSName." ".$OSArchi,
        OSCOMMENTS => $OSComment,
        OSVERSION => $OSVersion,
      });
}
1;
© 2025 GrazzMean