diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-10-02 02:33:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-02 02:33:24 -0700 |
commit | 32a2ce8fc0eb590140cad81cf0ca9adf2daa5651 (patch) | |
tree | 2e8d95f306f3aab013fb264dd2c12b8a6c4bc5ce | |
parent | 74879c8c172e5c7db491c80ad3a2f8fcdc33beb8 (diff) | |
parent | 57f4149a87ab7fd44a614658bd3d5ebc725285cd (diff) | |
download | podman-32a2ce8fc0eb590140cad81cf0ca9adf2daa5651.tar.gz podman-32a2ce8fc0eb590140cad81cf0ca9adf2daa5651.tar.bz2 podman-32a2ce8fc0eb590140cad81cf0ca9adf2daa5651.zip |
Merge pull request #4166 from giuseppe/set-dbus-session-if-not-set
rootless: set DBUS_SESSION_BUS_ADDRESS if it is not set
-rw-r--r-- | libpod/runtime.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 675c92b7a..9f3549e00 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -387,6 +387,13 @@ func SetXdgDirs() error { return errors.Wrapf(err, "cannot set XDG_RUNTIME_DIR") } + if rootless.IsRootless() && os.Getenv("DBUS_SESSION_BUS_ADDRESS") == "" { + sessionAddr := filepath.Join(runtimeDir, "bus") + if _, err := os.Stat(sessionAddr); err == nil { + os.Setenv("DBUS_SESSION_BUS_ADDRESS", fmt.Sprintf("unix:path=%s", sessionAddr)) + } + } + // Setup XDG_CONFIG_HOME if cfgHomeDir := os.Getenv("XDG_CONFIG_HOME"); cfgHomeDir == "" { if cfgHomeDir, err = util.GetRootlessConfigHomeDir(); err != nil { |