[installer] Create a blank grubenv if doesn't exist. (#17414) (#17525)

This commit is contained in:
mssonicbld 2023-12-16 01:40:44 +08:00 committed by GitHub
parent 6dba9f8305
commit b16e2da1be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,14 +264,6 @@ demo_install_grub()
exit 1 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 if [ "$demo_type" = "DIAG" ] ; then
# Install GRUB in the partition also. This allows for # Install GRUB in the partition also. This allows for
# chainloading the DIAG image from another OS. # chainloading the DIAG image from another OS.
@ -354,14 +346,6 @@ demo_install_uefi_grub()
} }
rm -f $grub_install_log 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 # Configure EFI NVRAM Boot variables. --create also sets the
# new boot number as active. # new boot number as active.
grub=$(find /boot/efi/EFI/$demo_volume_label/ -name grub*.efi -exec basename {} \;) grub=$(find /boot/efi/EFI/$demo_volume_label/ -name grub*.efi -exec basename {} \;)
@ -631,6 +615,14 @@ EOF
umount $demo_mnt umount $demo_mnt
else else
cp $grub_cfg $onie_initrd_tmp/$demo_mnt/grub/grub.cfg 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 fi
cd / cd /