1

Update reboot-windows to look for UEFI boot entry

This commit is contained in:
Jessie Hildebrandt 2024-08-20 14:24:30 -04:00
parent 1c9aed3d3c
commit 1325566857

View File

@ -13,14 +13,15 @@
REBOOT_CMD=$(cat <<EOF
# Find the exact name of the first Windows menuentry in grub.cfg
WINDOWS_ENTRY=\$(sudo grep menuentry /boot/grub2/grub.cfg | grep -Po "'.*Windows.*?'" | grep -o "[^'].*[^']")
# Find the ID of the Windows entry in the UEFI boot manager
WINDOWS_ENTRY=\$(efibootmgr | grep -Po "Boot.*Windows" | grep -Po "[[:digit:]]+");
# Set next_entry in grubenv to the Windows menuentry
sudo grub2-reboot "\$WINDOWS_ENTRY";
# Set BootNext in the UEFI boot manager to the Windows entry
#sudo grub2-reboot "\$WINDOWS_ENTRY";
sudo efibootmgr --bootnext "\$WINDOWS_ENTRY";
# Copy grubenv to the OpenSUSE grub EFI folder (/boot/grub2/ is not visible on UEFI installs)
sudo cp /boot/grub2/grubenv /boot/efi/EFI/opensuse/grubenv
#sudo cp /boot/grub2/grubenv /boot/efi/EFI/opensuse/grubenv;
# Reboot!
sudo reboot;