From b16e2da1be7e5e3afc4cf77c0ab652de9803f700 Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Sat, 16 Dec 2023 01:40:44 +0800 Subject: [PATCH] [installer] Create a blank grubenv if doesn't exist. (#17414) (#17525) --- installer/default_platform.conf | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/installer/default_platform.conf b/installer/default_platform.conf index fca775447692..7a9fe00ecf4e 100755 --- a/installer/default_platform.conf +++ b/installer/default_platform.conf @@ -264,14 +264,6 @@ demo_install_grub() exit 1 } - # Create a blank environment block file. - if [ ! -f "$onie_initrd_tmp/$demo_mnt/grub/grubenv" ]; then - grub-editenv "$onie_initrd_tmp/$demo_mnt/grub/grubenv" create || { - echo "ERROR: grub-editenv failed on: $blk_dev" - exit 1 - } - fi - if [ "$demo_type" = "DIAG" ] ; then # Install GRUB in the partition also. This allows for # chainloading the DIAG image from another OS. @@ -354,14 +346,6 @@ demo_install_uefi_grub() } rm -f $grub_install_log - # Create a blank environment block file. - if [ ! -f "$demo_mnt/grub/grubenv" ]; then - grub-editenv "$demo_mnt/grub/grubenv" create || { - echo "ERROR: grub-editenv failed on: $blk_dev" - exit 1 - } - fi - # Configure EFI NVRAM Boot variables. --create also sets the # new boot number as active. grub=$(find /boot/efi/EFI/$demo_volume_label/ -name grub*.efi -exec basename {} \;) @@ -631,6 +615,14 @@ EOF umount $demo_mnt else cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg + + # Create a blank environment block file. + if [ ! -f "$onie_initrd_tmp/$demo_mnt/grub/grubenv" ]; then + grub-editenv "$onie_initrd_tmp/$demo_mnt/grub/grubenv" create || { + echo "ERROR: grub-editenv failed on: $blk_dev" + exit 1 + } + fi fi cd /