kernel import must not have absolute path

This commit is contained in:
Christian Goll
2021-10-14 11:37:41 +02:00
parent 9d89a3b8dd
commit 7c6c96fc4f
2 changed files with 3 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
// Checking if container flag was set, then overwriting OptRoot
kernelVersion := args[0]
kernelName := kernelVersion
if len(args) > 1 {
if len(args) > 1 {
kernelName = args[1]
}
if OptContainer != "" {

View File

@@ -102,6 +102,7 @@ func ListKernels() ([]string, error) {
func Build(kernelVersion string, kernelName string, root string) (string, error) {
kernelImage := path.Join(root, "/boot/vmlinuz-"+kernelVersion)
kernelDrivers := path.Join(root, "/lib/modules/"+kernelVersion)
kernelDriversRelative := path.Join("/lib/modules/"+kernelVersion)
kernelDestination := KernelImage(kernelName)
driversDestination := KmodsImage(kernelName)
versionDestination := KernelVersion(kernelName)
@@ -177,7 +178,7 @@ func Build(kernelVersion string, kernelName string, root string) (string, error)
wwlog.Printf(wwlog.VERBOSE, "Using PIGZ to compress the container: %s\n", compressor)
}
cmd := fmt.Sprintf("cd /; find .%s | cpio --quiet -o -H newc | %s -c > \"%s\"", kernelDrivers, compressor, driversDestination)
cmd := fmt.Sprintf("cd %s; find .%s | cpio --quiet -o -H newc | %s -c > \"%s\"", root, kernelDriversRelative, compressor, driversDestination)
wwlog.Printf(wwlog.DEBUG, "RUNNING: %s\n", cmd)
err = exec.Command("/bin/sh", "-c", cmd).Run()