summaryrefslogtreecommitdiff
path: root/cmd/podman/utils.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-01-29 11:31:16 -0500
committerGitHub <noreply@github.com>2018-01-29 11:31:16 -0500
commit562a5dea57e544717de8d6edb5b0d888299a77ab (patch)
tree8cde6902135df80a190a57c13894c669674dcf3d /cmd/podman/utils.go
parent099b5fb6f6fb1397afc664820239a904585ddd04 (diff)
parentaa5798d28fef206e20556a312959dc58bb52f153 (diff)
downloadpodman-562a5dea57e544717de8d6edb5b0d888299a77ab.tar.gz
podman-562a5dea57e544717de8d6edb5b0d888299a77ab.tar.bz2
podman-562a5dea57e544717de8d6edb5b0d888299a77ab.zip
Merge pull request #267 from mheon/remove_libkpod
Remove libkpod
Diffstat (limited to 'cmd/podman/utils.go')
-rw-r--r--cmd/podman/utils.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go
new file mode 100644
index 000000000..4c42c8ff5
--- /dev/null
+++ b/cmd/podman/utils.go
@@ -0,0 +1,55 @@
+package main
+
+import (
+ "github.com/containers/storage"
+ "github.com/projectatomic/libpod/libpod"
+ "github.com/urfave/cli"
+)
+
+// Generate a new libpod runtime configured by command line options
+func getRuntime(c *cli.Context) (*libpod.Runtime, error) {
+ options := []libpod.RuntimeOption{}
+
+ if c.GlobalIsSet("root") || c.GlobalIsSet("runroot") ||
+ c.GlobalIsSet("storage-opt") || c.GlobalIsSet("storage-driver") {
+ storageOpts := storage.DefaultStoreOptions
+
+ if c.GlobalIsSet("root") {
+ storageOpts.GraphRoot = c.GlobalString("root")
+ }
+ if c.GlobalIsSet("runroot") {
+ storageOpts.RunRoot = c.GlobalString("runroot")
+ }
+ if c.GlobalIsSet("storage-driver") {
+ storageOpts.GraphDriverName = c.GlobalString("storage-driver")
+ }
+ if c.GlobalIsSet("storage-opt") {
+ storageOpts.GraphDriverOptions = c.GlobalStringSlice("storage-opt")
+ }
+
+ options = append(options, libpod.WithStorageConfig(storageOpts))
+ }
+
+ // TODO CLI flags for image config?
+ // TODO CLI flag for signature policy?
+
+ if c.GlobalIsSet("runtime") {
+ options = append(options, libpod.WithOCIRuntime(c.GlobalString("runtime")))
+ }
+
+ if c.GlobalIsSet("conmon") {
+ options = append(options, libpod.WithConmonPath(c.GlobalString("conmon")))
+ }
+
+ // TODO flag to set CGroup manager?
+ // TODO flag to set libpod static dir?
+ // TODO flag to set libpod tmp dir?
+
+ if c.GlobalIsSet("cni-config-dir") {
+ options = append(options, libpod.WithCNIConfigDir(c.GlobalString("cni-config-dir")))
+ }
+
+ // TODO flag to set CNI plugins dir?
+
+ return libpod.NewRuntime(options...)
+}