refactor
This commit is contained in:
parent
b7ad579d3b
commit
ecddc2fe21
@ -52,7 +52,7 @@ type Agent struct {
|
|||||||
EXE string
|
EXE string
|
||||||
SystemDrive string
|
SystemDrive string
|
||||||
MeshInstaller string
|
MeshInstaller string
|
||||||
MeshSystemEXE string
|
MeshSystemBin string
|
||||||
MeshSVC string
|
MeshSVC string
|
||||||
PyBin string
|
PyBin string
|
||||||
Headers map[string]string
|
Headers map[string]string
|
||||||
@ -114,15 +114,15 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||||||
restyC.SetRootCertificate(ac.Cert)
|
restyC.SetRootCertificate(ac.Cert)
|
||||||
}
|
}
|
||||||
|
|
||||||
var MeshSysExe string
|
var MeshSysBin string
|
||||||
if len(ac.CustomMeshDir) > 0 {
|
if len(ac.CustomMeshDir) > 0 {
|
||||||
MeshSysExe = filepath.Join(ac.CustomMeshDir, "MeshAgent.exe")
|
MeshSysBin = filepath.Join(ac.CustomMeshDir, "MeshAgent.exe")
|
||||||
} else {
|
} else {
|
||||||
MeshSysExe = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe")
|
MeshSysBin = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe")
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
MeshSysExe = "/opt/tacticalmesh/meshagent"
|
MeshSysBin = "/opt/tacticalmesh/meshagent"
|
||||||
}
|
}
|
||||||
|
|
||||||
svcConf := &service.Config{
|
svcConf := &service.Config{
|
||||||
@ -152,7 +152,7 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||||||
EXE: exe,
|
EXE: exe,
|
||||||
SystemDrive: sd,
|
SystemDrive: sd,
|
||||||
MeshInstaller: "meshagent.exe",
|
MeshInstaller: "meshagent.exe",
|
||||||
MeshSystemEXE: MeshSysExe,
|
MeshSystemBin: MeshSysBin,
|
||||||
MeshSVC: meshSvcName,
|
MeshSVC: meshSvcName,
|
||||||
PyBin: pybin,
|
PyBin: pybin,
|
||||||
Headers: headers,
|
Headers: headers,
|
||||||
|
@ -278,14 +278,14 @@ func (a *Agent) NixMeshNodeID() string {
|
|||||||
meshSuccess := false
|
meshSuccess := false
|
||||||
a.Logger.Debugln("Getting mesh node id")
|
a.Logger.Debugln("Getting mesh node id")
|
||||||
|
|
||||||
if !trmm.FileExists(a.MeshSystemEXE) {
|
if !trmm.FileExists(a.MeshSystemBin) {
|
||||||
a.Logger.Debugln(a.MeshSystemEXE, "does not exist. Skipping.")
|
a.Logger.Debugln(a.MeshSystemBin, "does not exist. Skipping.")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := a.NewCMDOpts()
|
opts := a.NewCMDOpts()
|
||||||
opts.IsExecutable = true
|
opts.IsExecutable = true
|
||||||
opts.Shell = a.MeshSystemEXE
|
opts.Shell = a.MeshSystemBin
|
||||||
opts.Command = "-nodeid"
|
opts.Command = "-nodeid"
|
||||||
|
|
||||||
for !meshSuccess {
|
for !meshSuccess {
|
||||||
|
@ -150,7 +150,7 @@ func (a *Agent) Install(i *Installer) {
|
|||||||
if len(i.MeshDir) > 0 {
|
if len(i.MeshDir) > 0 {
|
||||||
installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe")
|
installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe")
|
||||||
} else {
|
} else {
|
||||||
installerMeshSystemEXE = a.MeshSystemEXE
|
installerMeshSystemEXE = a.MeshSystemBin
|
||||||
}
|
}
|
||||||
|
|
||||||
var meshNodeID string
|
var meshNodeID string
|
||||||
|
Loading…
Reference in New Issue
Block a user