mirror of
https://github.com/rancher/os.git
synced 2025-09-06 01:01:43 +00:00
Move around code for better clarity
This commit is contained in:
committed by
niusmallnan
parent
2f50b7b178
commit
1f50386828
32
pkg/init/sharedroot/sharedroot.go
Normal file
32
pkg/init/sharedroot/sharedroot.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package sharedroot
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/pkg/init/fsmount"
|
||||
)
|
||||
|
||||
func Setup(c *config.CloudConfig) (*config.CloudConfig, error) {
|
||||
if c.Rancher.NoSharedRoot {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
if fsmount.IsInitrd() {
|
||||
for _, i := range []string{"/mnt", "/media", "/var/lib/system-docker"} {
|
||||
if err := os.MkdirAll(i, 0755); err != nil {
|
||||
return c, err
|
||||
}
|
||||
if err := mount.Mount("tmpfs", i, "tmpfs", "rw"); err != nil {
|
||||
return c, err
|
||||
}
|
||||
if err := mount.MakeShared(i); err != nil {
|
||||
return c, err
|
||||
}
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
return c, mount.MakeShared("/")
|
||||
}
|
Reference in New Issue
Block a user