This commit is contained in:
Michael Winters 2025-08-16 07:45:26 +02:00 committed by GitHub
commit f6406c6182
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 0 deletions

View File

@ -465,6 +465,14 @@ func createContainer(container, image, release, authFile string, showCommandToEn
"--volume", runtimeDirectoryMountArg,
}...)
if podman.CheckVersion("3.2.0") {
if runtime, _ := podman.GetRuntimeName(); runtime == "crun" {
createArgs = append(createArgs, []string{
"--group-add", "keep-groups",
}...)
}
}
createArgs = append(createArgs, avahiSocketMount...)
createArgs = append(createArgs, kcmSocketMount...)
createArgs = append(createArgs, mediaMount...)

View File

@ -213,6 +213,31 @@ func GetImages(args ...string) ([]Image, error) {
return images, nil
}
// GetRuntimeName returns OCI Runtime of Podman in a string
func GetRuntimeName() (string, error) {
var stdout bytes.Buffer
logLevelString := LogLevel.String()
args := []string{"--log-level", logLevelString, "info", "--format", "json"}
if err := shell.Run("podman", nil, &stdout, nil, args...); err != nil {
return "", err
}
var podmanInfo struct {
Host struct {
OCIRuntime struct {
Name string `json:"name"`
} `json:"ociRuntime"`
} `json:"host"`
}
if err := json.Unmarshal(stdout.Bytes(), &podmanInfo); err != nil {
return "", err
}
return podmanInfo.Host.OCIRuntime.Name, nil
}
// GetVersion returns version of Podman in a string
func GetVersion() (string, error) {
if podmanVersion != "" {