Copy from inside the container to avoid permission problems
This commit is contained in:
parent
a0ed1eb1f5
commit
bf455d9788
31
kernel.go
31
kernel.go
@ -374,20 +374,6 @@ func generateBaseDockerImage(registry string, commands []config.DockerCommand,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyDirContent(source, target string) (err error) {
|
|
||||||
files, err := ioutil.ReadDir(source)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(files) != 0 {
|
|
||||||
_, err = sh(source, "cp -r * "+target+"/")
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (err error) {
|
func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (err error) {
|
||||||
tmpdir, err := os.MkdirTemp("", "out-of-tree-"+pkgname+"-")
|
tmpdir, err := os.MkdirTemp("", "out-of-tree-"+pkgname+"-")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -475,15 +461,22 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = copyDirContent(c.Volumes.LibModules, volumes.LibModules)
|
c.Args = append(c.Args, "-v", volumes.LibModules+":/target/lib/modules")
|
||||||
|
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/"
|
||||||
|
|
||||||
|
files, err := ioutil.ReadDir(c.Volumes.UsrSrc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = copyDirContent(c.Volumes.UsrSrc, volumes.UsrSrc)
|
if len(files) != 0 {
|
||||||
if err != nil {
|
cmd += " && cp -r /usr/src/* /target/usr/src/"
|
||||||
return
|
|
||||||
}
|
}
|
||||||
err = copyDirContent(c.Volumes.Boot, volumes.Boot)
|
|
||||||
|
_, err = c.Run("/tmp", cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user