aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-21 07:31:25 -0500
committerGitHub <noreply@github.com>2022-01-21 07:31:25 -0500
commitc6fd8a421263f5e0386b6f711ea62e68b0188ad6 (patch)
treebe644b40d35032a638beaa09e5df4d660b453907
parent3074a98378e7916fde46981f4f5c0885754a13f2 (diff)
parentdbaaef5c4cdeac07449230a7b69adc9173b97309 (diff)
downloadpodman-c6fd8a421263f5e0386b6f711ea62e68b0188ad6.tar.gz
podman-c6fd8a421263f5e0386b6f711ea62e68b0188ad6.tar.bz2
podman-c6fd8a421263f5e0386b6f711ea62e68b0188ad6.zip
Merge pull request #12924 from afbjorklund/package-alpine
Show package version when running on alpine
-rw-r--r--libpod/util.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/libpod/util.go b/libpod/util.go
index 2b96a9449..307caa8c5 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -150,6 +150,10 @@ func queryPackageVersion(cmdArg ...string) string {
if outp, err := cmd.Output(); err == nil {
output = string(outp)
}
+ if cmdArg[0] == "/sbin/apk" {
+ prefix := cmdArg[len(cmdArg)-1] + " is owned by "
+ output = strings.Replace(output, prefix, "", 1)
+ }
}
return strings.Trim(output, "\n")
}
@@ -157,10 +161,11 @@ func queryPackageVersion(cmdArg ...string) string {
func packageVersion(program string) string { // program is full path
packagers := [][]string{
{"/usr/bin/rpm", "-q", "-f"},
- {"/usr/bin/dpkg", "-S"}, // Debian, Ubuntu
- {"/usr/bin/pacman", "-Qo"}, // Arch
- {"/usr/bin/qfile", "-qv"}, // Gentoo (quick)
- {"/usr/bin/equery", "b"}, // Gentoo (slow)
+ {"/usr/bin/dpkg", "-S"}, // Debian, Ubuntu
+ {"/usr/bin/pacman", "-Qo"}, // Arch
+ {"/usr/bin/qfile", "-qv"}, // Gentoo (quick)
+ {"/usr/bin/equery", "b"}, // Gentoo (slow)
+ {"/sbin/apk", "info", "-W"}, // Alpine
}
for _, cmd := range packagers {