vendor latest c/common

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-06-04 17:49:02 +02:00
parent 7c5c60bc39
commit 15a4e1dffd
14 changed files with 63 additions and 42 deletions

View File

@@ -1,3 +1,5 @@
//go:build (freebsd || netbsd || openbsd)
package config
const (

View File

@@ -5,7 +5,7 @@ import "os"
const (
// _configPath is the path to the containers/containers.conf
// inside a given config directory.
_configPath = "containers\\containers.conf"
_configPath = "\\containers\\containers.conf"
// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = ""

View File

@@ -350,9 +350,9 @@ default_sysctls = [
# The firewall driver to be used by netavark.
# The default is empty which means netavark will pick one accordingly. Current supported
# drivers are "iptables", "none" (no firewall rules will be created) and "firewalld" (firewalld is
# experimental at the moment and not recommend outside of testing). In the future we are
# planning to add support for a "nftables" driver.
# drivers are "iptables", "nftables", "none" (no firewall rules will be created) and "firewalld" (firewalld is
# experimental at the moment and not recommend outside of testing).
#
#firewall_driver = ""
@@ -890,10 +890,10 @@ default_sysctls = [
[podmansh]
# Shell to spawn in container. Default: /bin/sh.
#shell = "/bin/sh"
#
#
# Name of the container the podmansh user should join.
#container = "podmansh"
#
#
# Default timeout in seconds for podmansh logins.
# Favored over the deprecated "podmansh_timeout" field.
#timeout = 30

View File

@@ -1,3 +1,5 @@
//go:build (freebsd || netbsd || openbsd)
package config
// DefaultInitPath is the default path to the container-init binary.

View File

@@ -1,4 +1,4 @@
//go:build !freebsd
//go:build !freebsd && !netbsd
package config

View File

@@ -1,4 +1,4 @@
//go:build linux || darwin || freebsd
//go:build linux || darwin || freebsd || netbsd
package password

View File

@@ -25,7 +25,8 @@ func queryPackageVersion(cmdArg ...string) string {
cmd := exec.Command(cmdArg[0], cmdArg[1:]...)
if outp, err := cmd.Output(); err == nil {
output = string(outp)
if cmdArg[0] == "/usr/bin/dlocate" {
switch cmdArg[0] {
case "/usr/bin/dlocate":
// can return multiple matches
l := strings.Split(output, "\n")
output = l[0]
@@ -44,19 +45,24 @@ func queryPackageVersion(cmdArg ...string) string {
}
}
}
} else if cmdArg[0] == "/usr/bin/dpkg" {
case "/usr/bin/dpkg":
r := strings.Split(output, ": ")
queryFormat := `${Package}_${Version}_${Architecture}`
cmd = exec.Command("/usr/bin/dpkg-query", "-f", queryFormat, "-W", r[0])
if outp, err := cmd.Output(); err == nil {
output = string(outp)
}
case "/usr/bin/pacman":
pkg := strings.Trim(output, "\n")
cmd = exec.Command(cmdArg[0], "-Q", "--", pkg)
if outp, err := cmd.Output(); err == nil {
output = strings.ReplaceAll(string(outp), " ", "-")
}
case "/sbin/apk":
prefix := cmdArg[len(cmdArg)-1] + " is owned by "
output = strings.Replace(output, prefix, "", 1)
}
}
if cmdArg[0] == "/sbin/apk" {
prefix := cmdArg[len(cmdArg)-1] + " is owned by "
output = strings.Replace(output, prefix, "", 1)
}
}
return strings.Trim(output, "\n")
}
@@ -77,7 +83,7 @@ func Package(program string) string { // program is full path
{"rpm", []string{"/usr/bin/rpm", "-q", "-f"}},
{"deb", []string{"/usr/bin/dlocate", "-F"}}, // Debian, Ubuntu (quick)
{"deb", []string{"/usr/bin/dpkg", "-S"}}, // Debian, Ubuntu (slow)
{"pacman", []string{"/usr/bin/pacman", "-Qo"}}, // Arch
{"pacman", []string{"/usr/bin/pacman", "-Qoq"}}, // Arch
{"gentoo", []string{"/usr/bin/qfile", "-qv"}}, // Gentoo (quick)
{"gentoo", []string{"/usr/bin/equery", "b"}}, // Gentoo (slow)
{"apk", []string{"/sbin/apk", "info", "-W"}}, // Alpine