Skip to content

Commit

Permalink
Merge pull request #2002 from giuseppe/try-to-set-DBUS_SESSION_BUS_AD…
Browse files Browse the repository at this point in the history
…DRESS-if-unset

config: attempt to guess DBUS_SESSION_BUS_ADDRESS
  • Loading branch information
openshift-merge-bot[bot] committed May 17, 2024
2 parents fa276b3 + 464e79b commit ec0a25c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,19 @@ func (c *Config) CheckCgroupsAndAdjustConfig() {
return
}

session := os.Getenv("DBUS_SESSION_BUS_ADDRESS")
hasSession := session != ""
if hasSession {
hasSession := false

session, found := os.LookupEnv("DBUS_SESSION_BUS_ADDRESS")
if !found {
sessionAddr := filepath.Join(os.Getenv("XDG_RUNTIME_DIR"), "bus")
if err := fileutils.Exists(sessionAddr); err == nil {
sessionAddr, err = filepath.EvalSymlinks(sessionAddr)
if err == nil {
os.Setenv("DBUS_SESSION_BUS_ADDRESS", "unix:path="+sessionAddr)
hasSession = true
}
}
} else {
for _, part := range strings.Split(session, ",") {
if strings.HasPrefix(part, "unix:path=") {
err := fileutils.Exists(strings.TrimPrefix(part, "unix:path="))
Expand Down

1 comment on commit ec0a25c

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.