0f44ff1d3b
Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
33 lines
755 B
Go
33 lines
755 B
Go
package main
|
|
|
|
import (
|
|
is "github.com/containers/image/storage"
|
|
"github.com/containers/storage"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
func getStore(c *cli.Context) (storage.Store, error) {
|
|
options := storage.DefaultStoreOptions
|
|
if c.GlobalIsSet("root") {
|
|
options.GraphRoot = c.GlobalString("root")
|
|
}
|
|
if c.GlobalIsSet("runroot") {
|
|
options.RunRoot = c.GlobalString("runroot")
|
|
}
|
|
|
|
if c.GlobalIsSet("storage-driver") {
|
|
options.GraphDriverName = c.GlobalString("storage-driver")
|
|
}
|
|
if c.GlobalIsSet("storage-opt") {
|
|
opts := c.GlobalStringSlice("storage-opt")
|
|
if len(opts) > 0 {
|
|
options.GraphDriverOptions = opts
|
|
}
|
|
}
|
|
store, err := storage.GetStore(options)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
is.Transport.SetStore(store)
|
|
return store, nil
|
|
}
|