bootdeploy: fallback to vmlinuz* kernels when zboot is set (MR 47)

Some kernel packages (e.g. linux-lts in Alpine) don't ship linux.efi, so
this needs to fallback to "vmlinuz" or else it won't be able to find a
kernel for boot-deploy.
This commit is contained in:
Clayton Craft
2024-01-29 15:22:46 -08:00
parent e2f4e6254f
commit 1a99953aa2

View File

@@ -95,13 +95,16 @@ func (b *BootDeploy) Run() error {
}
func getKernelPath(outDir string, zboot bool) ([]string, error) {
kernFile := "vmlinuz*"
var kernels []string
if zboot {
kernFile = "linux.efi"
kernels, _ = filepath.Glob(filepath.Join(outDir, "linux.efi"))
if len(kernels) > 0 {
return kernels, nil
}
// else fallback to vmlinuz* below
}
var kernels []string
kernFile := "vmlinuz*"
kernels, _ = filepath.Glob(filepath.Join(outDir, kernFile))
if len(kernels) == 0 {
return nil, errors.New("Unable to find any kernels at " + filepath.Join(outDir, kernFile))