forked from keybase/client
/
install.go
64 lines (53 loc) · 2.12 KB
/
install.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2017 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package service
import (
"time"
"golang.org/x/net/context"
"github.com/keybase/client/go/install"
"github.com/keybase/client/go/libkb"
keybase1 "github.com/keybase/client/go/protocol/keybase1"
"github.com/keybase/go-framed-msgpack-rpc/rpc"
)
type InstallHandler struct {
*BaseHandler
libkb.Contextified
}
func NewInstallHandler(xp rpc.Transporter, g *libkb.GlobalContext) *InstallHandler {
return &InstallHandler{
BaseHandler: NewBaseHandler(g, xp),
Contextified: libkb.NewContextified(g),
}
}
func (h *InstallHandler) FuseStatus(_ context.Context, arg keybase1.FuseStatusArg) (keybase1.FuseStatus, error) {
status := install.KeybaseFuseStatus(arg.BundleVersion, h.G().Log)
return status, nil
}
func (h *InstallHandler) InstallFuse(context.Context) (keybase1.InstallResult, error) {
components := []string{"helper", "fuse"}
result := install.Install(
h.G(), "", "", components, false, 120*time.Second, h.G().Log)
return result, nil
}
func (h *InstallHandler) InstallKBFS(context.Context) (keybase1.InstallResult, error) {
components := []string{"mountdir", "kbfs", "redirector"}
result := install.Install(
h.G(), "", "", components, false, 120*time.Second, h.G().Log)
return result, nil
}
func (h *InstallHandler) UninstallKBFS(context.Context) (keybase1.UninstallResult, error) {
// If we're uninstalling the FUSE kext, we need to uninstall the
// redirector first because it uses that module. That means one
// user's uninstall request will affect the other users on the
// same machine -- but that was true anyway when uninstalling the
// kext if the other users didn't have KBFS actively mounted.
components := []string{"redirector", "kbfs", "mountdir", "fuse"}
result := install.Uninstall(h.G(), components, h.G().Log)
return result, nil
}
func (h *InstallHandler) InstallCommandLinePrivileged(context.Context) (keybase1.InstallResult, error) {
components := []string{"clipaths"}
result := install.Install(
h.G(), "", "", components, false, 120*time.Second, h.G().Log)
return result, nil
}