func ctlStop(g *libkb.GlobalContext, components map[string]bool, wait time.Duration) error { if libkb.IsBrewBuild { return ctlBrewStop(g) } runMode := g.Env.GetRunMode() g.Log.Debug("Components: %v", components) errs := []error{} if ok := components[install.ComponentNameApp.String()]; ok { if err := install.TerminateApp(g, g.Log); err != nil { errs = append(errs, err) } } if ok := components[install.ComponentNameService.String()]; ok { if _, err := launchd.Stop(install.DefaultServiceLabel(runMode), wait, g.Log); err != nil { errs = append(errs, err) } } if ok := components[install.ComponentNameKBFS.String()]; ok { if _, err := launchd.Stop(install.DefaultKBFSLabel(runMode), wait, g.Log); err != nil { errs = append(errs, err) } } if ok := components[install.ComponentNameUpdater.String()]; ok { if _, err := launchd.Stop(install.DefaultUpdaterLabel(runMode), wait, g.Log); err != nil { errs = append(errs, err) } } return libkb.CombineErrors(errs...) }
func ctlStart(g *libkb.GlobalContext, components map[string]bool) error { if libkb.IsBrewBuild { return ctlBrewStart(g) } runMode := g.Env.GetRunMode() g.Log.Debug("Components: %v", components) errs := []error{} if ok := components[install.ComponentNameService.String()]; ok { if err := startLaunchdService(g, install.DefaultServiceLabel(runMode), g.Env.GetServiceInfoPath(), true); err != nil { errs = append(errs, err) g.Log.Errorf("%s", err) } } if ok := components[install.ComponentNameKBFS.String()]; ok { if err := startLaunchdService(g, install.DefaultKBFSLabel(runMode), g.Env.GetKBFSInfoPath(), true); err != nil { errs = append(errs, err) g.Log.Errorf("%s", err) } } if ok := components[install.ComponentNameUpdater.String()]; ok { if err := launchd.Start(install.DefaultUpdaterLabel(runMode), defaultLaunchdWait, g.Log); err != nil { errs = append(errs, err) g.Log.Errorf("%s", err) } } if ok := components[install.ComponentNameApp.String()]; ok { if err := install.RunApp(g, g.Log); err != nil { errs = append(errs, err) g.Log.Errorf("%s", err) } } return libkb.CombineErrors(errs...) }
func uninstallKBFSServices(g *libkb.GlobalContext, runMode libkb.RunMode) error { err1 := launchd.Uninstall(AppKBFSLabel.labelForRunMode(runMode), true, nil) err2 := launchd.Uninstall(BrewKBFSLabel.labelForRunMode(runMode), true, nil) return libkb.CombineErrors(err1, err2) }
func uninstallKBFSServices(runMode libkb.RunMode, log Log) error { err1 := launchd.Uninstall(defaultKBFSLabel(runMode, false), defaultLaunchdWait, log) err2 := launchd.Uninstall(defaultKBFSLabel(runMode, true), defaultLaunchdWait, log) return libkb.CombineErrors(err1, err2) }