mirror of
https://github.com/criyle/go-sandbox.git
synced 2025-11-04 14:49:53 +08:00
fix mount point on arm arch
This commit is contained in:
parent
7cebfb4eb8
commit
3ed7b771c8
@ -1,6 +1,8 @@
|
|||||||
package rununshared
|
package rununshared
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/criyle/go-judger/mount"
|
"github.com/criyle/go-judger/mount"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
@ -54,7 +56,12 @@ var (
|
|||||||
// GetDefaultMounts returns default mount parameters for given root
|
// GetDefaultMounts returns default mount parameters for given root
|
||||||
func GetDefaultMounts(root string, add []AddBind) []*mount.Mount {
|
func GetDefaultMounts(root string, add []AddBind) []*mount.Mount {
|
||||||
mounts := make([]*mount.Mount, 0, len(DefaultMounts)+len(add))
|
mounts := make([]*mount.Mount, 0, len(DefaultMounts)+len(add))
|
||||||
mounts = append(mounts, DefaultMounts...)
|
// check if bind mount source exists, e.g. /lib64 does not exists on arm
|
||||||
|
for _, m := range DefaultMounts {
|
||||||
|
if _, err := os.Stat(m.Source); !os.IsNotExist(err) {
|
||||||
|
mounts = append(mounts, m)
|
||||||
|
}
|
||||||
|
}
|
||||||
for _, m := range add {
|
for _, m := range add {
|
||||||
flags := bind
|
flags := bind
|
||||||
if m.ReadOnly {
|
if m.ReadOnly {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user