From e0b63aee1ab84258974f5fbbaa22156a0bc55c36 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sun, 14 May 2023 22:16:32 +0000 Subject: [PATCH] fix: handle existing debian kernels correctly --- kernel/kernel.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/kernel/kernel.go b/kernel/kernel.go index a5f5743..810859c 100644 --- a/kernel/kernel.go +++ b/kernel/kernel.go @@ -329,7 +329,16 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e return } - moddirs, err := ioutil.ReadDir(c.Volumes.LibModules) + searchdir := c.Volumes.LibModules + + if sk.DistroType == config.Debian { + // Debian has different kernels (package version) by the + // same name (ABI), so we need to separate /boot + c.Volumes = debian.ContainerVolumes(sk.DockerName(), pkgname) + searchdir = config.Dir("volumes", sk.DockerName()) + } + + moddirs, err := ioutil.ReadDir(searchdir) if err != nil { return } @@ -401,16 +410,6 @@ func installKernel(sk config.KernelMask, pkgname string, force, headers bool) (e return } - // Debian has different kernels (package version) by the - // same name (ABI), so we need to separate /boot - - volumes.LibModules = config.Dir("volumes", sk.DockerName(), - pkgname, "/lib/modules") - volumes.UsrSrc = config.Dir("volumes", sk.DockerName(), - pkgname, "/usr/src") - volumes.Boot = config.Dir("volumes", sk.DockerName(), - pkgname, "/boot") - pkgs := []snapshot.Package{dk.Image} if headers { pkgs = append(pkgs, dk.Headers...)