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