1
0
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:
Darren Shepherd
2018-09-15 21:55:26 -07:00
committed by niusmallnan
parent 2f50b7b178
commit 1f50386828
112 changed files with 992 additions and 859 deletions

View 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("/")
}