From 904dec2164bee3d5276fe061c779fedebe6515af Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 29 Dec 2020 20:29:35 +0100 Subject: Add support for Gentoo file to package query On Gentoo systems where `app-portage/gentoolkit` is installed the binary `equery` is used to query for information on which package a file belongs to. Signed-off-by: Michael Vetter --- libpod/util.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libpod/util.go b/libpod/util.go index 8faf665e7..bf9bf2542 100644 --- a/libpod/util.go +++ b/libpod/util.go @@ -153,6 +153,10 @@ func queryPackageVersion(cmdArg ...string) string { return strings.Trim(output, "\n") } +func equeryVersion(path string) string { + return queryPackageVersion("/usr/bin/equery", "b", path) +} + func pacmanVersion(path string) string { return queryPackageVersion("/usr/bin/pacman", "-Qo", path) } @@ -172,7 +176,10 @@ func packageVersion(program string) string { if out := dpkgVersion(program); out != unknownPackage { return out } - return pacmanVersion(program) + if out := pacmanVersion(program); out != unknownPackage { + return out + } + return equeryVersion(program) } func programVersion(mountProgram string) (string, error) { -- cgit v1.2.3-54-g00ecf