diff --git a/internal/app/wwctl/kernel/imprt/main.go b/internal/app/wwctl/kernel/imprt/main.go index f8b7f143..f2412240 100644 --- a/internal/app/wwctl/kernel/imprt/main.go +++ b/internal/app/wwctl/kernel/imprt/main.go @@ -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 != "" { diff --git a/internal/pkg/kernel/kernel.go b/internal/pkg/kernel/kernel.go index 7b342a2b..0d1024a8 100644 --- a/internal/pkg/kernel/kernel.go +++ b/internal/pkg/kernel/kernel.go @@ -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()