summaryrefslogtreecommitdiff
path: root/cmd/podman/main_remote.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-06 17:42:54 +0200
committerGitHub <noreply@github.com>2019-08-06 17:42:54 +0200
commit37b40e9acdae6bfa79d53928361540754417cdc6 (patch)
tree77a8f189ed503f5c75efa27a4702ea8b4e004bb0 /cmd/podman/main_remote.go
parent3bffe77f824772b841080ea463324f5ae5c833d4 (diff)
parent5779e898090b7182ad9307e3ddf1087ac913c770 (diff)
downloadpodman-37b40e9acdae6bfa79d53928361540754417cdc6.tar.gz
podman-37b40e9acdae6bfa79d53928361540754417cdc6.tar.bz2
podman-37b40e9acdae6bfa79d53928361540754417cdc6.zip
Merge pull request #3466 from TomSweeneyRedHat/dev/tsweeney/myhome
Touch up XDG, add rootless links
Diffstat (limited to 'cmd/podman/main_remote.go')
-rw-r--r--cmd/podman/main_remote.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/cmd/podman/main_remote.go b/cmd/podman/main_remote.go
index ecbb44d5a..d534f5bcb 100644
--- a/cmd/podman/main_remote.go
+++ b/cmd/podman/main_remote.go
@@ -8,7 +8,8 @@ import (
"os/user"
"path/filepath"
- "github.com/docker/docker/pkg/homedir"
+ "github.com/containers/libpod/pkg/util"
+ "github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -31,9 +32,19 @@ func init() {
}
func setSyslog() error {
+ var err error
+ cfgHomeDir := os.Getenv("XDG_CONFIG_HOME")
+ if cfgHomeDir == "" {
+ if cfgHomeDir, err = util.GetRootlessConfigHomeDir(); err != nil {
+ return err
+ }
+ if err = os.Setenv("XDG_CONFIG_HOME", cfgHomeDir); err != nil {
+ return errors.Wrapf(err, "cannot set XDG_CONFIG_HOME")
+ }
+ }
+ path := filepath.Join(cfgHomeDir, "containers")
+
// Log to file if not using syslog
- homeDir := homedir.Get()
- path := filepath.Join(homeDir, ".config", "containers")
if _, err := os.Stat(path); os.IsNotExist(err) {
if err := os.MkdirAll(path, 0750); err != nil {