From f51dfb5411b735cd8ea0c1cd517283300a4ebb2d Mon Sep 17 00:00:00 2001 From: Adrien Raffin-Caboisse Date: Fri, 15 Oct 2021 18:22:37 +0200 Subject: [PATCH] feat(netclient): config file cleanup on linux --- netclient/daemon/systemd.go | 7 +++++++ netclient/functions/common.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/netclient/daemon/systemd.go b/netclient/daemon/systemd.go index 93bf4c77..6662d0fd 100644 --- a/netclient/daemon/systemd.go +++ b/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") diff --git a/netclient/functions/common.go b/netclient/functions/common.go index 46f6a614..22d7f206 100644 --- a/netclient/functions/common.go +++ b/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) }