From 4a5cbfad070d93c8c80d4a0b9db7e7e953f9e18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20L=C3=B6nnegren?= Date: Mon, 25 Mar 2024 11:10:40 +0100 Subject: [PATCH] Backwards compatible recovery boot configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recovery system has been changed to extract the kernel/initrd and bootargs.cfg in order to not rely on loopback devices. This commit adds backwards compatibility to the grub configuration in case we have upgraded the bootloader but not the recovery system on a host. Signed-off-by: Fredrik Lönnegren --- .../embedded/grub-config/etc/elemental/grub.cfg | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/features/embedded/grub-config/etc/elemental/grub.cfg b/pkg/features/embedded/grub-config/etc/elemental/grub.cfg index 0850d30f0cc..5d17c9c6cba 100644 --- a/pkg/features/embedded/grub-config/etc/elemental/grub.cfg +++ b/pkg/features/embedded/grub-config/etc/elemental/grub.cfg @@ -112,11 +112,16 @@ menuentry "${display_name} recovery" --id recovery { # Check the presence of the image and fallback to legacy path if not present set img=/recovery.img - if [ ! -f "${img}" ]; then + if [ -f "${img}" ]; then + source (${root})/boot/bootargs.cfg + linux (${root})${kernel} ${kernelcmd} ${extra_cmdline} ${extra_recovery_cmdline} + initrd (${root})${initramfs} + else + # Boot using legacy recovery system, everything is included in the loopback image. set img=/cOS/recovery.img + set_loopdevice ${img} + source_bootargs + linux (${volume})${kernel} ${kernelcmd} ${extra_cmdline} ${extra_recovery_cmdline} + initrd (${volume})${initramfs} fi - - source (${root})/boot/bootargs.cfg - linux (${root})${kernel} ${kernelcmd} ${extra_cmdline} ${extra_recovery_cmdline} - initrd (${root})${initramfs} }