Browse Source

Merge pull request #357 from SekoiaLab/feat/uninstall-on-linux

Feat/uninstall on linux
dcarns 3 years ago
parent
commit
cfe8386389
2 changed files with 9 additions and 0 deletions
  1. 7 0
      netclient/daemon/systemd.go
  2. 2 0
      netclient/functions/common.go

+ 7 - 0
netclient/daemon/systemd.go

@@ -97,6 +97,13 @@ WantedBy=timers.target
 	return nil
 }
 
+func CleanupLinux() {
+	err := os.RemoveAll(ncutils.GetNetclientPath())
+	if err != nil {
+		ncutils.PrintLog("Removing netclient binary: "+err.Error(), 1)
+	}
+}
+
 // RemoveSystemDServices - removes the systemd services on a machine
 func RemoveSystemDServices(network string) error {
 	//sysExec, err := exec.LookPath("systemctl")

+ 2 - 0
netclient/functions/common.go

@@ -158,6 +158,8 @@ func Uninstall() error {
 		daemon.CleanupWindows()
 	} else if ncutils.IsMac() {
 		daemon.CleanupMac()
+	} else if ncutils.IsLinux() {
+		daemon.CleanupLinux()
 	} else if !ncutils.IsKernel() {
 		ncutils.PrintLog("manual cleanup required", 1)
 	}