Commit 4f42a268 authored by Henry's avatar Henry

fixed --force flag for shutdown after update

parent d9552fea
...@@ -6,6 +6,10 @@ import ( ...@@ -6,6 +6,10 @@ import (
"github.com/jbenet/go-ipfs/core/commands" "github.com/jbenet/go-ipfs/core/commands"
) )
func init() {
cmdIpfsUpdate.Flag.Bool("force", false, "force shutdown of daemon when updating")
}
var cmdIpfsUpdate = &commander.Command{ var cmdIpfsUpdate = &commander.Command{
UsageLine: "update", UsageLine: "update",
Short: "check for updates and apply them", Short: "check for updates and apply them",
...@@ -20,7 +24,7 @@ I wont even try, @jbenet. You do this much better :)`, ...@@ -20,7 +24,7 @@ I wont even try, @jbenet. You do this much better :)`,
Run: makeCommand(command{ Run: makeCommand(command{
name: "updateApply", name: "updateApply",
args: 0, args: 0,
flags: nil, flags: []string{"force"},
online: true, online: true,
cmdFn: commands.UpdateApply, cmdFn: commands.UpdateApply,
}), }),
......
...@@ -25,13 +25,13 @@ func UpdateApply(n *core.IpfsNode, args []string, opts map[string]interface{}, o ...@@ -25,13 +25,13 @@ func UpdateApply(n *core.IpfsNode, args []string, opts map[string]interface{}, o
fmt.Fprintln(out, "New Version:", u.Version) fmt.Fprintln(out, "New Version:", u.Version)
_, onDaemon := opts["onDaemon"] _, onDaemon := opts["onDaemon"]
_, force := opts["force"] force := opts["force"].(bool)
if onDaemon && !force { if onDaemon && !force {
return fmt.Errorf(`Error: update must stop running ipfs service. return fmt.Errorf(`Error: update must stop running ipfs service.
You may want to abort the update, or shut the service down manually. You may want to abort the update, or shut the service down manually.
To shut it down automatically, run: To shut it down automatically, run:
ipfs update apply -f ipfs update --force
`) `)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment