Created
June 18, 2024 17:46
-
-
Save shello/6cd4e7a0f963ce7855b4ee413796480c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
target_boot_name='Windows Boot Manager' | |
windows_boot_id="$(efibootmgr --unicode | grep "$target_boot_name" | sed 's/Boot\([0-9a-fA-F]\{4\}\)\*\? .*/\1/')" | |
if [ ${#windows_boot_id} -ne 4 ]; then | |
echo "$0: Could not find boot id for Windows." | |
exit 1 | |
fi | |
if ! sudo efibootmgr -n "$windows_boot_id"; then | |
echo "$0: Could not set NextBoot with efibootmgr." >&2 | |
exit 1 | |
fi | |
sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment