func DefaultLaunchdEnvVars(g *libkb.GlobalContext, label string) []launchd.EnvVar { return []launchd.EnvVar{ launchd.NewEnvVar("KEYBASE_LABEL", label), launchd.NewEnvVar("KEYBASE_LOG_FORMAT", "file"), launchd.NewEnvVar("KEYBASE_RUNTIME_DIR", g.Env.GetRuntimeDir()), } }
func kbfsPlist(context Context, kbfsBinPath string, label string) (plist launchd.Plist, err error) { mountDir, err := context.GetMountDir() if err != nil { return } logFile := filepath.Join(context.GetLogDir(), libkb.KBFSLogFileName) startLogFile := filepath.Join(context.GetLogDir(), libkb.StartLogFileName) err = libkb.MakeParentDirs(startLogFile) if err != nil { return } // TODO: Remove debug flag when doing real release plistArgs := []string{ "-debug", fmt.Sprintf("-log-file=%s", logFile), fmt.Sprintf("-runtime-dir=%s", context.GetRuntimeDir()), } if context.GetRunMode() == libkb.DevelRunMode { plistArgs = append(plistArgs, fmt.Sprintf("-server-root=%s", context.GetRuntimeDir())) } plistArgs = append(plistArgs, mountDir) envVars := DefaultLaunchdEnvVars(label) envVars = append(envVars, launchd.NewEnvVar("KEYBASE_RUN_MODE", string(context.GetRunMode()))) plist = launchd.NewPlist(label, kbfsBinPath, plistArgs, envVars, startLogFile, defaultPlistComment) _, err = os.Stat(mountDir) if err != nil { return } return }
func keybasePlist(context Context, binPath string, label string, log Log) (launchd.Plist, error) { // TODO: Remove -d when doing real release logFile := filepath.Join(context.GetLogDir(), libkb.ServiceLogFileName) startLogFile := filepath.Join(context.GetLogDir(), libkb.StartLogFileName) err := libkb.MakeParentDirs(startLogFile) if err != nil { return launchd.Plist{}, err } plistArgs := []string{"-d", fmt.Sprintf("--log-file=%s", logFile), "service"} envVars := DefaultLaunchdEnvVars(label) envVars = append(envVars, launchd.NewEnvVar("KEYBASE_RUN_MODE", string(context.GetRunMode()))) return launchd.NewPlist(label, binPath, plistArgs, envVars, startLogFile, defaultPlistComment), nil }
// DefaultLaunchdEnvVars returns default environment vars for launchd func DefaultLaunchdEnvVars(label string) []launchd.EnvVar { return []launchd.EnvVar{ launchd.NewEnvVar("KEYBASE_LABEL", label), launchd.NewEnvVar("KEYBASE_SERVICE_TYPE", "launchd"), } }