Support mount with target folder in box exec

Also mount bind before pivotroot, this fixes bind mounting in general
This commit is contained in:
Ettore Di Giacinto
2020-04-21 17:30:27 +02:00
parent 4cee27da7f
commit 9321a310a5
2 changed files with 18 additions and 7 deletions

View File

@@ -75,9 +75,9 @@ func mountProc(newroot string) error {
return nil
}
func mountBind(hostfolder, newroot string) error {
func mountBind(hostfolder, newroot, dst string) error {
source := hostfolder
target := filepath.Join(newroot, hostfolder)
target := filepath.Join(newroot, dst)
fstype := "bind"
data := ""
@@ -90,5 +90,5 @@ func mountBind(hostfolder, newroot string) error {
}
func mountDev(newroot string) error {
return mountBind("/dev", newroot)
return mountBind("/dev", newroot, "/dev")
}