-
-
Save yrps/d68aab09da99b6505172 to your computer and use it in GitHub Desktop.
bash script for Pete
This file contains 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
#!/bin/bash | |
# script to set the default boot partition to Windows | |
# intended for Fedora20 with Grub2 | |
# https://ask.fedoraproject.org/en/question/9257/dual-boot-fedora-16-windows/ | |
# the configuration file of the bootloader | |
conf=/boot/grub2/grub.cfg | |
echo "Examining $conf..." | |
windowsentry=$(sudo grep 'menuentry .* windows' $conf) | |
windowsentry=$(echo $windowsentry | grep -o "'Windows[^']*'") | |
echo | |
if [ ! "$windowsentry" ]; then | |
echo "Error: $conf has no windows entry. Exiting." | |
exit 1 | |
fi | |
echo "Setting the default to $windowsentry..." | |
sudo grub2-set-default $windowsentry | |
echo | |
echo "Regenerating $conf..." | |
sudo grub2-mkconfig $conf | |
echo | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment