Merge pull request #3302 from crosbymichael/mkroot

Ensure that the rootfs dir is created in the bundle
This commit is contained in:
Wei Fu 2019-06-04 09:24:47 +08:00 committed by GitHub
commit faa5f55189
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -65,6 +65,10 @@ func newBundle(id, path, workDir string, spec []byte) (b *bundle, err error) {
os.RemoveAll(workDir) os.RemoveAll(workDir)
} }
}() }()
rootfs := filepath.Join(path, "rootfs")
if err := os.MkdirAll(rootfs, 0711); err != nil {
return nil, err
}
err = ioutil.WriteFile(filepath.Join(path, configFilename), spec, 0666) err = ioutil.WriteFile(filepath.Join(path, configFilename), spec, 0666)
return &bundle{ return &bundle{
id: id, id: id,

View File

@ -79,6 +79,11 @@ func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bun
if err := os.MkdirAll(filepath.Dir(work), 0711); err != nil { if err := os.MkdirAll(filepath.Dir(work), 0711); err != nil {
return nil, err return nil, err
} }
rootfs := filepath.Join(b.Path, "rootfs")
if err := os.MkdirAll(rootfs, 0711); err != nil {
return nil, err
}
paths = append(paths, rootfs)
if err := os.Mkdir(work, 0711); err != nil { if err := os.Mkdir(work, 0711); err != nil {
if !os.IsExist(err) { if !os.IsExist(err) {
return nil, err return nil, err