Skip to content

Commit

Permalink
fix: Add TacticalRMM Remote_Mgmt support for MacOSX
Browse files Browse the repository at this point in the history
Closes #700
  • Loading branch information
g-bougard committed Jul 10, 2024
1 parent 19cfff3 commit 89fdc0d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Revision history for GLPI agent

1.11 not yet released

inventory:
* fix #700: Add TacticalRMM Remote_Mgmt support for MacOSX

1.10 Tue, 09 Jul 2024

core:
Expand Down
25 changes: 22 additions & 3 deletions lib/GLPI/Agent/Task/Inventory/Generic/Remote_Mgmt/TacticalRMM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ sub isEnabled {

} elsif (OSNAME eq 'linux') {
return 1 if has_file('/etc/tacticalagent');
} elsif (OSNAME eq 'darwin') {
return 1 if has_file('/private/etc/tacticalagent');
}

return 0;
Expand Down Expand Up @@ -61,6 +63,21 @@ sub _getAgentId {

return _winBased(%params) if OSNAME eq 'MSWin32';
return _linuxBased(%params) if OSNAME eq 'linux';
return _macosBased(%params) if OSNAME eq 'darwin';
}

sub _macosBased {
my (%params) = @_;

my $config = getAllLines(
file => '/private/etc/tacticalagent',
%params
);

my $json = decode_json($config)
or return;

return $json->{agentid};
}

sub _linuxBased {
Expand Down Expand Up @@ -92,9 +109,11 @@ sub _getVersion {
my (%params) = @_;

my $command = OSNAME eq 'MSWin32' ?
'"C:\\Program Files\\TacticalAgent\\tacticalrmm.exe" --version'
:
canRun("rmmagent") ? "rmmagent --version" : "/usr/local/bin/rmmagent --version";
'"C:\\Program Files\\TacticalAgent\\tacticalrmm.exe" --version' :
canRun("rmmagent") ? "rmmagent --version" :
canRun("tacticalagent") ? "tacticalagent --version" :
OSNAME eq 'darwin' ? "/opt/tacticalagent/tacticalagent --version" :
"/usr/local/bin/rmmagent --version";

# On windows, the command seems to output a BOM on the first line
my $line = getSanitizedString(getFirstLine(
Expand Down

0 comments on commit 89fdc0d

Please sign in to comment.