mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Add dpkg support for returning oci/conmon versions
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1224 Approved by: baude
This commit is contained in:

committed by
Atomic Bot

parent
33d6221ae3
commit
0f1086cf7c
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user