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

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

View File

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

View File

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

View File

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