MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / main

Function main

pkg/init/cmd/init/init.go:203–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201}
202
203func main() {
204 // test if we want to do this, ie if tmpfs or ramfs
205 // we could be booting off ISO, disk where we do not need this
206 var sfs unix.Statfs_t
207 if err := unix.Statfs("/", &sfs); err != nil {
208 log.Fatalf("Cannot statfs /: %v", err)
209 }
210 const ramfsMagic = 0x858458f6
211 const tmpfsMagic = 0x01021994
212 if sfs.Type == ramfsMagic || sfs.Type == tmpfsMagic {
213 const newRoot = "/mnt"
214
215 if err := copyFS(newRoot); err != nil {
216 log.Fatalf("Copy root failed: %v", err)
217 }
218 }
219
220 // exec /sbin/init
221 if err := syscall.Exec("/sbin/init", []string{"/sbin/init"}, os.Environ()); err != nil {
222 log.Fatalf("Cannot exec /sbin/init")
223 }
224}

Callers

nothing calls this directly

Calls 1

copyFSFunction · 0.85

Tested by

no test coverage detected