summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders F Björklund <anders.f.bjorklund@gmail.com>2022-01-19 16:30:25 +0100
committerAnders F Björklund <anders.f.bjorklund@gmail.com>2022-01-19 18:55:03 +0100
commitdbaaef5c4cdeac07449230a7b69adc9173b97309 (patch)
treef533478654261b440539219f17e5b4e896b08aee
parent8301a7cd828c4576c1e581cb2dd376f42a363a11 (diff)
downloadpodman-dbaaef5c4cdeac07449230a7b69adc9173b97309.tar.gz
podman-dbaaef5c4cdeac07449230a7b69adc9173b97309.tar.bz2
podman-dbaaef5c4cdeac07449230a7b69adc9173b97309.zip
Show package version when running on alpine
Tested manually. [NO NEW TESTS NEEDED] Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
-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 {