mac agent
This commit is contained in:
parent
e0cfb7c90e
commit
852dfee29f
6 changed files with 170 additions and 45 deletions
|
|
@ -15,17 +15,16 @@ https://license.tacticalrmm.com
|
|||
package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
trmm "github.com/wh1te909/trmm-shared"
|
||||
)
|
||||
|
||||
const (
|
||||
etcConfig = "/etc/tacticalagent"
|
||||
)
|
||||
|
||||
func (a *Agent) checkExistingAndRemove(silent bool) {}
|
||||
|
||||
func (a *Agent) installerMsg(msg, alert string, silent bool) {
|
||||
if alert == "error" {
|
||||
a.Logger.Fatalln(msg)
|
||||
|
|
@ -51,6 +50,31 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me
|
|||
}
|
||||
}
|
||||
|
||||
func (a *Agent) checkExistingAndRemove(silent bool) {
|
||||
if runtime.GOOS == "darwin" {
|
||||
if trmm.FileExists(a.MeshSystemEXE) {
|
||||
a.Logger.Infoln("Existing meshagent found, attempting to remove...")
|
||||
uopts := a.NewCMDOpts()
|
||||
uopts.Command = fmt.Sprintf("%s -fulluninstall", a.MeshSystemEXE)
|
||||
uout := a.CmdV2(uopts)
|
||||
fmt.Println(uout.Stdout)
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
if trmm.FileExists(macPlistPath) {
|
||||
a.Logger.Infoln("Existing tacticalagent plist found, attempting to remove...")
|
||||
opts := a.NewCMDOpts()
|
||||
opts.Command = fmt.Sprintf("launchctl bootout system %s", macPlistPath)
|
||||
a.CmdV2(opts)
|
||||
}
|
||||
|
||||
os.RemoveAll(macMeshSvcDir)
|
||||
os.Remove(etcConfig)
|
||||
os.RemoveAll(nixAgentDir)
|
||||
os.Remove(macPlistPath)
|
||||
}
|
||||
}
|
||||
|
||||
func DisableSleepHibernate() {}
|
||||
|
||||
func EnablePing() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue