diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2018-08-24 14:48:49 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-24 18:56:19 +0000 |
commit | 3473701de201dc2d5c24643eca392f0a3236f1bc (patch) | |
tree | 82f78a9b4ebef3afc8cb1fd5c936c7bfb3a19120 | |
parent | facdfbc596ccc279755091b3408e83f0db26d536 (diff) | |
download | podman-3473701de201dc2d5c24643eca392f0a3236f1bc.tar.gz podman-3473701de201dc2d5c24643eca392f0a3236f1bc.tar.bz2 podman-3473701de201dc2d5c24643eca392f0a3236f1bc.zip |
rootless: allow to override policy.json by the user
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1336
Approved by: mheon
-rw-r--r-- | libpod/runtime.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 87b2d10a2..adeb901f2 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -263,7 +263,14 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) { configPath := ConfigPath foundConfig := true if rootless.IsRootless() { - configPath = filepath.Join(os.Getenv("HOME"), ".config/containers/libpod.conf") + home := os.Getenv("HOME") + if runtime.config.SignaturePolicyPath == "" { + newPath := filepath.Join(home, ".config/containers/policy.json") + if _, err := os.Stat(newPath); err == nil { + runtime.config.SignaturePolicyPath = newPath + } + } + configPath = filepath.Join(home, ".config/containers/libpod.conf") if _, err := os.Stat(configPath); err != nil { foundConfig = false } |