Esempio n. 1
0
// Uninstall uninstalls all keybase services
func Uninstall(context Context, components []string, log Log) keybase1.UninstallResult {
	var err error
	componentResults := []keybase1.ComponentResult{}

	log.Debug("Uninstalling components: %s", components)

	if libkb.IsIn(string(ComponentNameCLI), components, false) {
		err = uninstallCommandLine()
		componentResults = append(componentResults, componentResult(string(ComponentNameCLI), err))
	}

	if libkb.IsIn(string(ComponentNameKBFS), components, false) {
		var mountDir string
		mountDir, err = context.GetMountDir()
		if err == nil {
			err = UninstallKBFS(context.GetRunMode(), mountDir, true, log)
		}
		componentResults = append(componentResults, componentResult(string(ComponentNameKBFS), err))
	}

	if libkb.IsIn(string(ComponentNameService), components, false) {
		err = uninstallKeybaseServices(context.GetRunMode(), log)
		componentResults = append(componentResults, componentResult(string(ComponentNameService), err))
	}

	if libkb.IsIn(string(ComponentNameUpdater), components, false) {
		err = uninstallUpdater(context.GetRunMode(), log)
		componentResults = append(componentResults, componentResult(string(ComponentNameUpdater), err))
	}

	return newUninstallResult(componentResults)
}
Esempio n. 2
0
// Install installs all keybase components
func Install(context Context, binPath string, components []string, force bool, log Log) keybase1.InstallResult {
	var err error
	componentResults := []keybase1.ComponentResult{}

	log.Debug("Installing components: %s", components)

	if libkb.IsIn(string(ComponentNameUpdater), components, false) {
		err = installUpdater(context, binPath, force, log)
		componentResults = append(componentResults, componentResult(string(ComponentNameUpdater), err))
	}

	if libkb.IsIn(string(ComponentNameCLI), components, false) {
		err = installCommandLine(context, binPath, true, log) // Always force CLI install
		componentResults = append(componentResults, componentResult(string(ComponentNameCLI), err))
	}

	if libkb.IsIn(string(ComponentNameService), components, false) {
		err = installService(context, binPath, force, log)
		componentResults = append(componentResults, componentResult(string(ComponentNameService), err))
	}

	if libkb.IsIn(string(ComponentNameKBFS), components, false) {
		err = KBFS(context, binPath, force, log)
		componentResults = append(componentResults, componentResult(string(ComponentNameKBFS), err))
	}

	return newInstallResult(componentResults)
}
Esempio n. 3
0
func Uninstall(g *libkb.GlobalContext, components []string) keybase1.UninstallResult {
	var err error
	componentResults := []keybase1.ComponentResult{}

	g.Log.Debug("Uninstalling components: %s", components)

	if libkb.IsIn(string(ComponentNameCLI), components, false) {
		err = uninstallCommandLine()
		componentResults = append(componentResults, componentResult(string(ComponentNameCLI), err))
	}

	if libkb.IsIn(string(ComponentNameKBFS), components, false) {
		err = uninstallKBFS(g)
		componentResults = append(componentResults, componentResult(string(ComponentNameKBFS), err))
	}

	if libkb.IsIn(string(ComponentNameService), components, false) {
		err = uninstallService(g)
		componentResults = append(componentResults, componentResult(string(ComponentNameService), err))
	}

	return NewUninstallResult(componentResults)
}
Esempio n. 4
0
func Install(g *libkb.GlobalContext, binPath string, components []string, force bool) keybase1.InstallResult {
	var err error
	componentResults := []keybase1.ComponentResult{}

	g.Log.Debug("Installing components: %s", components)

	if libkb.IsIn(string(ComponentNameCLI), components, false) {
		err = installCommandLine(g, binPath, true) // Always force CLI install
		componentResults = append(componentResults, componentResult(string(ComponentNameCLI), err))
	}

	if libkb.IsIn(string(ComponentNameService), components, false) {
		err = installService(g, binPath, force)
		componentResults = append(componentResults, componentResult(string(ComponentNameService), err))
	}

	if libkb.IsIn(string(ComponentNameKBFS), components, false) {
		err = installKBFS(g, binPath, force)
		componentResults = append(componentResults, componentResult(string(ComponentNameKBFS), err))
	}

	return NewInstallResult(componentResults)
}
Esempio n. 5
0
func Install(g *libkb.GlobalContext, binPath string, components []string, force bool) []keybase1.InstallComponent {
	var err error
	status := []keybase1.InstallComponent{}

	g.Log.Debug("Installing components: %s", components)

	if libkb.IsIn("cli", components, false) {
		g.Log.Debug("Checking command line")
		err = installCommandLine(g, binPath, true) // Always force CLI install
		if err != nil {
			status = append(status, keybase1.InstallComponent{Name: "cli", Status: errorStatus("INSTALL_ERROR", err.Error())})
		} else {
			status = append(status, keybase1.InstallComponent{Name: "cli", Status: keybase1.Status{Name: "OK"}})
		}
	}

	if libkb.IsIn("service", components, false) {
		err = installService(g, binPath, force)
		if err != nil {
			status = append(status, keybase1.InstallComponent{Name: "service", Status: errorStatus("INSTALL_ERROR", err.Error())})
		} else {
			status = append(status, keybase1.InstallComponent{Name: "service", Status: keybase1.Status{Name: "OK"}})
		}
	}

	if libkb.IsIn("kbfs", components, false) {
		err = installKBFS(g, binPath, force)
		if err != nil {
			status = append(status, keybase1.InstallComponent{Name: "kbfs", Status: errorStatus("INSTALL_ERROR", err.Error())})
		} else {
			status = append(status, keybase1.InstallComponent{Name: "kbfs", Status: keybase1.Status{Name: "OK"}})
		}
	}

	return status
}