common
common copied to clipboard
Support varying install paths for containers.conf
Currently, the system locations for containers.conf
are hardcoded to /usr/share/containers/containers.conf
for the Default file and /etc/containers/containers.conf
for the System override. (And ~/.config/containers/containers.conf
for User overrides, but that's not really at issue in this Issue.)
As we've seen in some other Podman issues, recent versions of MacOS frown on system-level installs and modifications and package management systems like Homebrew install into some less Linux-y places like /opt/homebrew
.
I propose we make the search for containers.conf
more intelligent by inferring an install prefix based on the location of the binary that is currently executing. For example, if the currently executing binary is /opt/homebrew/bin/podman
we can infer that InstallPrefix is /opt/homebrew
. Then our search logic becomes:
Default file: ${Prefix}/share/containers/containers.conf
fall back to /usr/share/containers/containers.conf
System file: ${Prefix}/etc/containers/containers.conf
fall back to /etc/containers/containers.conf
I welcome thoughts from other contributors before launching into a PR.
Here is the current code...
https://github.com/containers/common/blob/2d46695412078739031f92901d73e28f01200d3a/pkg/config/config.go#L21-L31
https://github.com/containers/common/blob/2d46695412078739031f92901d73e28f01200d3a/pkg/config/config.go#L600
I am fine with this change, BUT this is more then just the code. Documentation and Google Memory will make this difficult.