additional mac support - mesh
This commit is contained in:
parent
7802532732
commit
78277d341d
3 changed files with 42 additions and 3 deletions
|
|
@ -6,4 +6,7 @@ https://github.com/amidaware/tacticalrmm
|
|||
env CGO_ENABLED=0 GOOS=<GOOS> GOARCH=<GOARCH> go build -ldflags "-s -w"
|
||||
```
|
||||
|
||||
|
||||
#### building the mac agent
|
||||
```
|
||||
env GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w"
|
||||
```
|
||||
|
|
@ -125,6 +125,10 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||
MeshSysExe = "/opt/tacticalmesh/meshagent"
|
||||
}
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
MeshSysExe = "/opt/tacticalmesh/meshagent"
|
||||
}
|
||||
|
||||
svcConf := &service.Config{
|
||||
Executable: exe,
|
||||
Name: winSvcName,
|
||||
|
|
|
|||
|
|
@ -159,9 +159,41 @@ func (a *Agent) AgentUpdate(url, inno, version string) {}
|
|||
|
||||
func (a *Agent) AgentUninstall(code string) {}
|
||||
|
||||
func (a *Agent) NixMeshNodeID() string { return "" }
|
||||
func (a *Agent) NixMeshNodeID() string {
|
||||
var meshNodeID string
|
||||
meshSuccess := false
|
||||
a.Logger.Debugln("Getting mesh node id")
|
||||
|
||||
func (a *Agent) getMeshNodeID() (string, error) { return "", nil }
|
||||
if !trmm.FileExists(a.MeshSystemEXE) {
|
||||
a.Logger.Debugln(a.MeshSystemEXE, "does not exist. Skipping.")
|
||||
return ""
|
||||
}
|
||||
|
||||
opts := a.NewCMDOpts()
|
||||
opts.IsExecutable = true
|
||||
opts.Shell = a.MeshSystemEXE
|
||||
opts.Command = "-nodeid"
|
||||
|
||||
for !meshSuccess {
|
||||
out := a.CmdV2(opts)
|
||||
meshNodeID = out.Stdout
|
||||
a.Logger.Debugln("Stdout:", out.Stdout)
|
||||
a.Logger.Debugln("Stderr:", out.Stderr)
|
||||
if meshNodeID == "" {
|
||||
time.Sleep(1 * time.Second)
|
||||
continue
|
||||
} else if strings.Contains(strings.ToLower(meshNodeID), "graphical version") || strings.Contains(strings.ToLower(meshNodeID), "zenity") {
|
||||
time.Sleep(1 * time.Second)
|
||||
continue
|
||||
}
|
||||
meshSuccess = true
|
||||
}
|
||||
return meshNodeID
|
||||
}
|
||||
|
||||
func (a *Agent) getMeshNodeID() (string, error) {
|
||||
return a.NixMeshNodeID(), nil
|
||||
}
|
||||
|
||||
func (a *Agent) RecoverMesh() {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue