inits/pkg/sys/mount.go

20 lines
408 B
Go
Raw Normal View History

2019-03-08 01:21:29 +00:00
package sys
import (
"log"
"os"
"syscall"
)
func Mount(source, target, fstype string, flags uintptr, data string) {
if _, err := os.Stat(target); os.IsNotExist(err) {
Mkdir(target, 0755)
}
if err := syscall.Mount(source, target, fstype, flags, data); err != nil {
log.Fatalf("FATAL: mount %q %q -t %q -o %q failed: %v", source, target, fstype, data, err)
}
log.Printf("mounted %q", target)
}