From 3473701de201dc2d5c24643eca392f0a3236f1bc Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 24 Aug 2018 14:48:49 +0200 Subject: rootless: allow to override policy.json by the user Signed-off-by: Giuseppe Scrivano Closes: #1336 Approved by: mheon --- libpod/runtime.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 } -- cgit v1.2.3-54-g00ecf