diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-08-07 06:42:02 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-07 14:16:26 +0000 |
commit | 0f1086cf7c2f8d5dbff2e31dfa4f4f8d3864281f (patch) | |
tree | 9c9b761a787d3278952c7cfd0aed63b6315dd404 | |
parent | 33d6221ae34103d68753156ff2638802817dfa16 (diff) | |
download | podman-0f1086cf7c2f8d5dbff2e31dfa4f4f8d3864281f.tar.gz podman-0f1086cf7c2f8d5dbff2e31dfa4f4f8d3864281f.tar.bz2 podman-0f1086cf7c2f8d5dbff2e31dfa4f4f8d3864281f.zip |
Add dpkg support for returning oci/conmon versions
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #1224
Approved by: baude
-rw-r--r-- | libpod/oci_linux.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go index e105680b7..bdf859d7d 100644 --- a/libpod/oci_linux.go +++ b/libpod/oci_linux.go @@ -113,10 +113,25 @@ func rpmVersion(path string) string { return strings.Trim(output, "\n") } +func dpkgVersion(path string) string { + output := "Unknown" + cmd := exec.Command("/usr/bin/dpkg", "-S", path) + if outp, err := cmd.Output(); err == nil { + output = string(outp) + } + return strings.Trim(output, "\n") +} + func (r *OCIRuntime) pathPackage() string { - return rpmVersion(r.path) + if out := rpmVersion(r.path); out != "Unknown" { + return out + } + return dpkgVersion(r.path) } func (r *OCIRuntime) conmonPackage() string { - return rpmVersion(r.conmonPath) + if out := rpmVersion(r.conmonPath); out != "Unknown" { + return out + } + return dpkgVersion(r.conmonPath) } |