Add optional install path

This allows users to consume the install functionality but also install
to other areas instead of the managed `/opt` dir.

```bash
> ctr install --path /usr/local
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2018-09-11 10:36:00 -04:00
parent ed2bf6dd8a
commit 60d13d63c4
3 changed files with 42 additions and 15 deletions

View File

@@ -37,6 +37,10 @@ var Command = cli.Command{
Name: "replace,r",
Usage: "replace any binaries or libs in the opt directory",
},
cli.StringFlag{
Name: "path",
Usage: "set an optional install path other than the managed opt directory",
},
},
Action: func(context *cli.Context) error {
client, ctx, cancel, err := commands.NewClient(context)
@@ -56,6 +60,9 @@ var Command = cli.Command{
if context.Bool("replace") {
opts = append(opts, containerd.WithInstallReplace)
}
if path := context.String("path"); path != "" {
opts = append(opts, containerd.WithInstallPath(path))
}
return client.Install(ctx, image, opts...)
},
}