2014-04-11 23:06:56 +08:00
|
|
|
// +build linux
|
|
|
|
|
|
|
|
package mount
|
|
|
|
|
2015-02-01 11:56:27 +08:00
|
|
|
import "syscall"
|
2014-04-11 23:06:56 +08:00
|
|
|
|
2015-02-01 11:56:27 +08:00
|
|
|
func msMoveRoot(rootfs string) error {
|
2014-07-15 07:55:49 +08:00
|
|
|
if err := syscall.Mount(rootfs, "/", "", syscall.MS_MOVE, ""); err != nil {
|
2015-02-01 11:56:27 +08:00
|
|
|
return err
|
2014-04-11 23:06:56 +08:00
|
|
|
}
|
2014-07-15 07:55:49 +08:00
|
|
|
if err := syscall.Chroot("."); err != nil {
|
2015-02-01 11:56:27 +08:00
|
|
|
return err
|
2014-04-11 23:06:56 +08:00
|
|
|
}
|
2014-07-15 07:55:49 +08:00
|
|
|
return syscall.Chdir("/")
|
2014-04-11 23:06:56 +08:00
|
|
|
}
|