Skip to content

Commit

Permalink
Merge pull request #1077 from RotherOSS/issue-#997-darwin
Browse files Browse the repository at this point in the history
Issue #997 darwin
  • Loading branch information
bschmalhofer committed Jun 10, 2021
2 parents 80f7223 + 3d9722e commit 79f1c28
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 49 deletions.
8 changes: 0 additions & 8 deletions Kernel/System/Environment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ sub OSInfoGet {
linux => 'Linux',
freebsd => 'FreeBSD',
openbsd => 'OpenBSD',
darwin => 'MacOSX',
);

# If used OS is a linux system
Expand Down Expand Up @@ -130,13 +129,6 @@ sub OSInfoGet {
}
}
}
elsif ( $^O eq 'darwin' ) {

my $MacVersion = `sw_vers -productVersion` || '';
chomp $MacVersion;

$OSName = 'MacOSX ' . $MacVersion;
}
elsif ( $^O eq 'freebsd' || $^O eq 'openbsd' ) {

my $BSDVersion = `uname -r` || '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ sub GetDisplayPath {
sub Run {
my $Self = shift;

# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
# Check if used OS is a supported system. See https://perldoc.perl.org/perlport#PLATFORMS.
return $Self->GetResults() unless $^O =~ m/(linux|unix|netbsd|freebsd)/i;

# find OTOBO partition
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
Expand Down
10 changes: 4 additions & 6 deletions Kernel/System/SupportDataCollector/Plugin/OS/DiskSpace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ sub Run {

# This plugin is temporary disabled
# A new logic is required to calculate the space
# TODO: fix
# TODO: see https://github.com/RotherOSS/otobo/issues/1076
return $Self->GetResults();

# # Check if used OS is a linux system
# if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
# return $Self->GetResults();
# }
#
## Check if used OS is a supported system. See https://perldoc.perl.org/perlport#PLATFORMS.
#return $Self->GetResults() unless $^O =~ m/(linux|unix|netbsd|freebsd)/i;

# # find OTOBO partition
# my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ sub GetDisplayPath {
sub Run {
my $Self = shift;

# Check if used OS is a Linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
# Check if used OS is a supported system. See https://perldoc.perl.org/perlport#PLATFORMS.
return $Self->GetResults() unless $^O =~ m/(linux|unix|netbsd|freebsd)/i;

my $Commandline = "df -lHx tmpfs -x iso9660 -x udf -x squashfs";

# current MacOS and FreeBSD does not support the -x flag for df
if ( $^O =~ /(darwin|freebsd)/i ) {
# currently FreeBSD does not support the -x flag for df
if ( $^O =~ /(freebsd)/i ) {
$Commandline = "df -lH";
}

Expand Down
6 changes: 2 additions & 4 deletions Kernel/System/SupportDataCollector/Plugin/OS/KernelVersion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ sub GetDisplayPath {
sub Run {
my $Self = shift;

# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
# Check if used OS is a supported system. See https://perldoc.perl.org/perlport#PLATFORMS.
return $Self->GetResults() unless $^O =~ m/(linux|unix|netbsd|freebsd)/i;

my $KernelVersion = "";
my $KernelInfo;
Expand Down
20 changes: 3 additions & 17 deletions Kernel/System/SupportDataCollector/Plugin/OS/Load.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ sub GetDisplayPath {
sub Run {
my $Self = shift;

# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
# Check if used OS is a supported system. See https://perldoc.perl.org/perlport#PLATFORMS.
return $Self->GetResults() unless $^O =~ m/(linux|unix|netbsd|freebsd)/i;

my @Loads;

# If used OS is a linux system
if ( $^O =~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
if ( $^O =~ /(linux|unix|netbsd|freebsd)/i ) {

# linux systems
if ( -e '/proc/loadavg' ) {
Expand All @@ -50,18 +48,6 @@ sub Run {
}
}

# mac os
elsif ( $^O =~ /darwin/i ) {
if ( open( my $In, '-|', "sysctl vm.loadavg" ) ) { ## no critic qw(OTOBO::ProhibitOpen InputOutput::RequireBriefOpen)
while (<$In>) {
if ( my ($Loads) = $_ =~ /vm\.loadavg: \s* \{ \s* (.*) \s* \}/smx ) {
@Loads = split ' ', $Loads;
}
}
close $In;
}
}

if (@Loads) {
$Self->AddResultInformation(
Label => Translatable('System Load'),
Expand Down
6 changes: 2 additions & 4 deletions Kernel/System/SupportDataCollector/Plugin/OS/Swap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ sub GetDisplayPath {
sub Run {
my $Self = shift;

# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
# Check if used OS is a supported system. See https://perldoc.perl.org/perlport#PLATFORMS.
return $Self->GetResults() unless $^O =~ m/(linux|unix|netbsd|freebsd)/i;

my $MemInfoFile;
my ( $MemTotal, $MemFree, $SwapTotal, $SwapFree );
Expand Down

0 comments on commit 79f1c28

Please sign in to comment.