summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-01-31 12:27:50 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-31 20:23:36 +0000
commit7f6a141839212c0d4d50324a726c5477817c8887 (patch)
tree94b20c90ce6d4ee14d67cfd096af5f61118c8885 /libpod
parent3c044f9267f62b8f7f88c7395ad325df3bf420f5 (diff)
downloadpodman-7f6a141839212c0d4d50324a726c5477817c8887.tar.gz
podman-7f6a141839212c0d4d50324a726c5477817c8887.tar.bz2
podman-7f6a141839212c0d4d50324a726c5477817c8887.zip
libpod/runtime.go: Stick paths in arrays
To account for more path possibilities, we now iterate a string array of possible paths to try and find paths to runc and conmon. Signed-off-by: baude <bbaude@redhat.com> Closes: #278 Approved by: baude
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index afde03904..cce396764 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -93,21 +93,22 @@ var (
)
func findConmonPath() string {
- path := "/usr/local/libexec/crio/conmon"
- _, err := os.Stat(path)
- if err != nil {
- path = "/usr/libexec/crio/conmon"
- }
- return path
+ paths := []string{"/usr/libexec/crio/conmon", "/usr/local/libexec/crio/conmon", "/usr/bin/conmon", "/usr/sbin/conmon"}
+ return pathHelper(paths)
}
func findRuncPath() string {
- path := "/usr/bin/runc"
- _, err := os.Stat(path)
- if err != nil {
- path = "/usr/sbin/runc"
+ paths := []string{"/usr/bin/runc", "/usr/sbin/runc", "/sbin/runc", "/bin/runc"}
+ return pathHelper(paths)
+}
+
+func pathHelper(paths []string) string {
+ for _, path := range paths {
+ if _, err := os.Stat(path); err == nil {
+ return path
+ }
}
- return path
+ return paths[0]
}
// NewRuntime creates a new container runtime