update mesh installpath

This commit is contained in:
wh1te909 2022-10-25 11:34:44 -07:00
parent 16df03678c
commit 552d63ea6e
4 changed files with 22 additions and 17 deletions

View File

@ -78,10 +78,12 @@ const (
meshSvcName = "mesh agent" meshSvcName = "mesh agent"
etcConfig = "/etc/tacticalagent" etcConfig = "/etc/tacticalagent"
nixAgentDir = "/opt/tacticalagent" nixAgentDir = "/opt/tacticalagent"
nixMeshDir = "/opt/tacticalmesh"
nixAgentBin = nixAgentDir + "/tacticalagent" nixAgentBin = nixAgentDir + "/tacticalagent"
nixMeshAgentBin = nixMeshDir + "/meshagent"
macPlistPath = "/Library/LaunchDaemons/tacticalagent.plist" macPlistPath = "/Library/LaunchDaemons/tacticalagent.plist"
macPlistName = "tacticalagent" macPlistName = "tacticalagent"
macMeshSvcDir = "/usr/local/mesh_services" defaultMacMeshSvcDir = "/usr/local/mesh_services"
) )
var winTempDir = filepath.Join(os.Getenv("PROGRAMDATA"), "TacticalRMM") var winTempDir = filepath.Join(os.Getenv("PROGRAMDATA"), "TacticalRMM")
@ -133,12 +135,14 @@ func New(logger *logrus.Logger, version string) *Agent {
} else { } else {
MeshSysExe = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe") MeshSysExe = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe")
} }
case "linux":
MeshSysExe = "/opt/tacticalmesh/meshagent"
case "darwin": case "darwin":
if trmm.FileExists(nixMeshAgentBin) {
MeshSysExe = nixMeshAgentBin
} else {
MeshSysExe = "/usr/local/mesh_services/meshagent/meshagent" MeshSysExe = "/usr/local/mesh_services/meshagent/meshagent"
}
default: default:
MeshSysExe = "/opt/tacticalmesh/meshagent" MeshSysExe = nixMeshAgentBin
} }
svcConf := &service.Config{ svcConf := &service.Config{

View File

@ -185,7 +185,7 @@ func (a *Agent) Install(i *Installer) {
} }
} else { } else {
opts := a.NewCMDOpts() opts := a.NewCMDOpts()
opts.Command = fmt.Sprintf("%s -install", meshOutput) opts.Command = fmt.Sprintf("%s -install --installPath=%s", meshOutput, nixMeshDir)
out := a.CmdV2(opts) out := a.CmdV2(opts)
if out.Status.Exit != 0 { if out.Status.Exit != 0 {
a.Logger.Fatalln("Error installing mesh agent:", out.Stderr) a.Logger.Fatalln("Error installing mesh agent:", out.Stderr)

View File

@ -68,7 +68,8 @@ func (a *Agent) checkExistingAndRemove(silent bool) {
a.CmdV2(opts) a.CmdV2(opts)
} }
os.RemoveAll(macMeshSvcDir) os.RemoveAll(defaultMacMeshSvcDir)
os.RemoveAll(nixMeshDir)
os.Remove(etcConfig) os.Remove(etcConfig)
os.RemoveAll(nixAgentDir) os.RemoveAll(nixAgentDir)
os.Remove(macPlistPath) os.Remove(macPlistPath)

View File

@ -25,7 +25,7 @@ import (
) )
var ( var (
version = "2.4.0" version = "2.4.1-dev"
log = logrus.New() log = logrus.New()
logFile *os.File logFile *os.File
) )