From 1a99953aa299ae661cf3f3016725a8b9b96c3a28 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Mon, 29 Jan 2024 15:22:46 -0800 Subject: [PATCH] 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. --- internal/bootdeploy/bootdeploy.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/bootdeploy/bootdeploy.go b/internal/bootdeploy/bootdeploy.go index 593c696..d91d2b2 100644 --- a/internal/bootdeploy/bootdeploy.go +++ b/internal/bootdeploy/bootdeploy.go @@ -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))