cmd/tailscaled: remove tailscaled binary on uninstall-system-daemon

Signed-off-by: Maisem Ali <maisem@tailscale.com>
pull/1632/head
Maisem Ali 4 years ago committed by Maisem Ali
parent db13b2d0c8
commit 1c98c5f103

@ -73,9 +73,18 @@ func uninstallSystemDaemonDarwin(args []string) (ret error) {
}
}
err = os.Remove(sysPlist)
if os.IsNotExist(err) {
err = nil
if err := os.Remove(sysPlist); err != nil {
if os.IsNotExist(err) {
err = nil
}
if ret == nil {
ret = err
}
}
if err := os.Remove(targetBin); err != nil {
if os.IsNotExist(err) {
err = nil
}
if ret == nil {
ret = err
}
@ -93,6 +102,9 @@ func installSystemDaemonDarwin(args []string) (err error) {
}
}()
// Best effort:
uninstallSystemDaemonDarwin(nil)
// Copy ourselves to /usr/local/bin/tailscaled.
if err := os.MkdirAll(filepath.Dir(targetBin), 0755); err != nil {
return err
@ -127,9 +139,6 @@ func installSystemDaemonDarwin(args []string) (err error) {
return err
}
// Best effort:
uninstallSystemDaemonDarwin(nil)
if err := ioutil.WriteFile(sysPlist, []byte(darwinLaunchdPlist), 0700); err != nil {
return err
}

Loading…
Cancel
Save