mirror of
https://github.com/containers/podman.git
synced 2025-12-10 15:47:46 +08:00
vendor containers/storage with https://github.com/containers/storage/pull/1165
Signed-off-by: Dan Čermák <dcermak@suse.com>
This commit is contained in:
46
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
46
vendor/github.com/containers/storage/drivers/overlay/overlay.go
generated
vendored
@@ -292,6 +292,31 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
|
||||
backingFs = fsName
|
||||
}
|
||||
|
||||
runhome := filepath.Join(options.RunRoot, filepath.Base(home))
|
||||
rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Create the driver home dir
|
||||
if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := idtools.MkdirAllAs(runhome, 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if opts.mountProgram == "" {
|
||||
if supported, err := SupportsNativeOverlay(home, runhome); err != nil {
|
||||
return nil, err
|
||||
} else if !supported {
|
||||
if path, err := exec.LookPath("fuse-overlayfs"); err == nil {
|
||||
opts.mountProgram = path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if opts.mountProgram != "" {
|
||||
if unshare.IsRootless() && isNetworkFileSystem(fsMagic) && opts.forceMask == nil {
|
||||
m := os.FileMode(0700)
|
||||
@@ -316,20 +341,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
|
||||
}
|
||||
}
|
||||
|
||||
rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Create the driver home dir
|
||||
if err := idtools.MkdirAllAs(path.Join(home, linkDir), 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
runhome := filepath.Join(options.RunRoot, filepath.Base(home))
|
||||
if err := idtools.MkdirAllAs(runhome, 0700, rootUID, rootGID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var usingMetacopy bool
|
||||
var supportsDType bool
|
||||
var supportsVolatile *bool
|
||||
@@ -569,14 +580,11 @@ func cachedFeatureRecord(runhome, feature string, supported bool, text string) (
|
||||
return err
|
||||
}
|
||||
|
||||
func SupportsNativeOverlay(graphroot, rundir string) (bool, error) {
|
||||
if os.Geteuid() != 0 || graphroot == "" || rundir == "" {
|
||||
func SupportsNativeOverlay(home, runhome string) (bool, error) {
|
||||
if os.Geteuid() != 0 || home == "" || runhome == "" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
home := filepath.Join(graphroot, "overlay")
|
||||
runhome := filepath.Join(rundir, "overlay")
|
||||
|
||||
var contents string
|
||||
flagContent, err := ioutil.ReadFile(getMountProgramFlagFile(home))
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user