Skip to content

Commit

Permalink
Merge pull request containers#1026 from dfr/freebsd
Browse files Browse the repository at this point in the history
Config changes and pkg/parse fixes for FreeBSD
  • Loading branch information
openshift-merge-robot authored May 10, 2022
2 parents 76bcbc8 + deed09d commit eb7cd4c
Show file tree
Hide file tree
Showing 13 changed files with 737 additions and 10 deletions.
6 changes: 1 addition & 5 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ const (
// _configPath is the path to the containers/containers.conf
// inside a given config directory.
_configPath = "containers/containers.conf"
// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/share/" + _configPath
// OverrideContainersConfig holds the default config path overridden by the root user
OverrideContainersConfig = "/etc/" + _configPath
// UserOverrideContainersConfig holds the containers config path overridden by the rootless user
UserOverrideContainersConfig = ".config/" + _configPath
)
Expand Down Expand Up @@ -803,7 +799,7 @@ func (c *Config) Validate() error {

func (c *EngineConfig) findRuntime() string {
// Search for crun first followed by runc, kata, runsc
for _, name := range []string{"crun", "runc", "kata", "runsc"} {
for _, name := range []string{"crun", "runc", "runj", "kata", "runsc"} {
for _, v := range c.OCIRuntimes[name] {
if _, err := os.Stat(v); err == nil {
return name
Expand Down
8 changes: 8 additions & 0 deletions pkg/config/config_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import (
"os"
)

const (
// OverrideContainersConfig holds the default config path overridden by the root user
OverrideContainersConfig = "/etc/" + _configPath

// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/share/" + _configPath
)

// podman remote clients on darwin cannot use unshare.isRootless() to determine the configuration file locations.
func customConfigFile() (string, error) {
if path, found := os.LookupEnv("CONTAINERS_CONF"); found {
Expand Down
8 changes: 8 additions & 0 deletions pkg/config/config_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import (
"os"
)

const (
// OverrideContainersConfig holds the default config path overridden by the root user
OverrideContainersConfig = "/usr/local/etc/" + _configPath

// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/local/share/" + _configPath
)

// podman remote clients on freebsd cannot use unshare.isRootless() to determine the configuration file locations.
func customConfigFile() (string, error) {
if path, found := os.LookupEnv("CONTAINERS_CONF"); found {
Expand Down
8 changes: 8 additions & 0 deletions pkg/config/config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import (
selinux "github.com/opencontainers/selinux/go-selinux"
)

const (
// OverrideContainersConfig holds the default config path overridden by the root user
OverrideContainersConfig = "/etc/" + _configPath

// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/share/" + _configPath
)

func selinuxEnabled() bool {
return selinux.GetEnabled()
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ image_copy_tmp_dir="storage"`
"/bin/runc",
"/usr/lib/cri-o-runc/sbin/runc",
},
"runj": {
"/usr/local/bin/runj",
},
"crun": {
"/usr/bin/crun",
"/usr/local/bin/crun",
Expand Down
8 changes: 8 additions & 0 deletions pkg/config/config_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ package config

import "os"

const (
// OverrideContainersConfig holds the default config path overridden by the root user
OverrideContainersConfig = "/etc/" + _configPath

// DefaultContainersConfig holds the default containers config path
DefaultContainersConfig = "/usr/share/" + _configPath
)

// podman remote clients on windows cannot use unshare.isRootless() to determine the configuration file locations.
func customConfigFile() (string, error) {
if path, found := os.LookupEnv("CONTAINERS_CONF"); found {
Expand Down
Loading

0 comments on commit eb7cd4c

Please sign in to comment.