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

@@ -25,6 +25,8 @@ type InstallConfig struct {
Libs bool
// Replace will overwrite existing binaries or libs in the opt directory
Replace bool
// Path to install libs and binaries to
Path string
}
// WithInstallLibs installs libs from the image
@@ -36,3 +38,10 @@ func WithInstallLibs(c *InstallConfig) {
func WithInstallReplace(c *InstallConfig) {
c.Replace = true
}
// WithInstallPath sets the optional install path
func WithInstallPath(path string) InstallOpts {
return func(c *InstallConfig) {
c.Path = path
}
}