1
0

Check that files exist before copy

This commit is contained in:
dump_stack() 2023-04-06 19:28:03 +00:00
parent 5931c08de1
commit ac5f83349c
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -466,10 +466,25 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
c.Args = append(c.Args, "-v", volumes.UsrSrc+":/target/usr/src")
c.Args = append(c.Args, "-v", volumes.Boot+":/target/boot")
cmd := "cp -r /lib/modules/* /target/lib/modules/" +
" && cp -r /boot/* /target/boot/"
cmd := "true"
files, err := ioutil.ReadDir(c.Volumes.UsrSrc)
files, err := ioutil.ReadDir(c.Volumes.Boot)
if err != nil {
return
}
if len(files) != 0 {
cmd += " && cp -r /boot/* /target/boot/"
}
files, err = ioutil.ReadDir(c.Volumes.LibModules)
if err != nil {
return
}
if len(files) != 0 {
cmd += " && cp -r /lib/modules/* /target/lib/modules/"
}
files, err = ioutil.ReadDir(c.Volumes.UsrSrc)
if err != nil {
return
}