mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
rootless: resolve the user home directory
Closes: https://github.com/projectatomic/libpod/issues/1073 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/projectatomic/libpod/libpod"
|
"github.com/projectatomic/libpod/libpod"
|
||||||
"github.com/projectatomic/libpod/pkg/rootless"
|
"github.com/projectatomic/libpod/pkg/rootless"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
@ -31,7 +32,13 @@ func GetRootlessStorageOpts() (storage.StoreOptions, error) {
|
|||||||
if home == "" {
|
if home == "" {
|
||||||
return opts, fmt.Errorf("neither XDG_DATA_HOME nor HOME was set non-empty")
|
return opts, fmt.Errorf("neither XDG_DATA_HOME nor HOME was set non-empty")
|
||||||
}
|
}
|
||||||
dataDir = filepath.Join(home, ".local", "share")
|
// runc doesn't like symlinks in the rootfs path, and at least
|
||||||
|
// on CoreOS /home is a symlink to /var/home, so resolve any symlink.
|
||||||
|
resolvedHome, err := filepath.EvalSymlinks(home)
|
||||||
|
if err != nil {
|
||||||
|
return opts, errors.Wrapf(err, "cannot resolve %s", home)
|
||||||
|
}
|
||||||
|
dataDir = filepath.Join(resolvedHome, ".local", "share")
|
||||||
}
|
}
|
||||||
opts.GraphRoot = filepath.Join(dataDir, "containers", "storage")
|
opts.GraphRoot = filepath.Join(dataDir, "containers", "storage")
|
||||||
opts.GraphDriverName = "vfs"
|
opts.GraphDriverName = "vfs"
|
||||||
|
Reference in New Issue
Block a user