From fa51d8f40ac506298106c8f0b7f2a52847fea61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Mon, 25 Mar 2024 10:03:54 +0100 Subject: [PATCH] Skip symlink if kernel already exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If kernel or initrd is named the default vmlinuz/initrd we skip the symlinking since the booting will work anyways. Signed-off-by: Fredrik Lönnegren --- pkg/elemental/elemental.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/elemental/elemental.go b/pkg/elemental/elemental.go index 52a9a9ed1b6..4356dd52212 100644 --- a/pkg/elemental/elemental.go +++ b/pkg/elemental/elemental.go @@ -549,6 +549,11 @@ func DeployRecoverySystem(cfg types.Config, img *types.Image, bootDir string) er "linux": kernel, "initrd": initrd, } { + // if kernel/initrd is actually named "vmlinuz"/"initrd" we just skip the symlink part. + if kernel == name || initrd == name { + continue + } + source := filepath.Join(bootDir, name) if exist, _ := utils.Exists(cfg.Fs, source, true); exist { cfg.Logger.Debugf("Removing old symlink %s", source)