提交 fa8fc1ae 作者: Juan Batiz-Benet

cmds2: check for updates

上级 e4b63028
...@@ -15,9 +15,10 @@ import ( ...@@ -15,9 +15,10 @@ import (
cmds "github.com/jbenet/go-ipfs/commands" cmds "github.com/jbenet/go-ipfs/commands"
cmdsCli "github.com/jbenet/go-ipfs/commands/cli" cmdsCli "github.com/jbenet/go-ipfs/commands/cli"
cmdsHttp "github.com/jbenet/go-ipfs/commands/http" cmdsHttp "github.com/jbenet/go-ipfs/commands/http"
"github.com/jbenet/go-ipfs/config" config "github.com/jbenet/go-ipfs/config"
"github.com/jbenet/go-ipfs/core" core "github.com/jbenet/go-ipfs/core"
daemon "github.com/jbenet/go-ipfs/daemon2" daemon "github.com/jbenet/go-ipfs/daemon2"
updates "github.com/jbenet/go-ipfs/updates"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
...@@ -207,12 +208,12 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) { ...@@ -207,12 +208,12 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) {
return nil, err return nil, err
} }
if useDaemon { cfg, err := req.Context().GetConfig()
if err != nil {
return nil, err
}
cfg, err := req.Context().GetConfig() if useDaemon {
if err != nil {
return nil, err
}
addr, err := ma.NewMultiaddr(cfg.Addresses.API) addr, err := ma.NewMultiaddr(cfg.Addresses.API)
if err != nil { if err != nil {
...@@ -235,6 +236,11 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) { ...@@ -235,6 +236,11 @@ func callCommand(req cmds.Request, root *cmds.Command) (cmds.Response, error) {
} else { } else {
log.Info("Executing command locally") log.Info("Executing command locally")
// Check for updates and potentially install one.
if err := updates.CliCheckForUpdates(cfg, req.Context().ConfigRoot); err != nil {
return nil, err
}
// this sets up the function that will initialize the node // this sets up the function that will initialize the node
// this is so that we can construct the node lazily. // this is so that we can construct the node lazily.
ctx := req.Context() ctx := req.Context()
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
) )
// CurrentVersionNumber is the current application's version literal // CurrentVersionNumber is the current application's version literal
const CurrentVersionNumber = "0.1.6" const CurrentVersionNumber = "0.1.7"
// Version regulates checking if the most recent version is run // Version regulates checking if the most recent version is run
type Version struct { type Version struct {
......
...@@ -200,7 +200,7 @@ func CliCheckForUpdates(cfg *config.Config, confFile string) error { ...@@ -200,7 +200,7 @@ func CliCheckForUpdates(cfg *config.Config, confFile string) error {
// if config says not to, don't check for updates // if config says not to, don't check for updates
if !cfg.Version.ShouldCheckForUpdate() { if !cfg.Version.ShouldCheckForUpdate() {
log.Info("update checking disabled.") log.Info("update check skipped.")
return nil return nil
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论