Created
October 8, 2012 09:33
-
-
Save mmdemirbas/3851637 to your computer and use it in GitHub Desktop.
Configures grub to set last used entry as default automatically in each boot
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
# @author: mmdemirbas@gmail.com | |
filename=/etc/default/grub | |
# Replace GRUB_DEFAULT value to 'saved' | |
echo :: Setting GRUB_DEFAULT=saved | |
sudo sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' $filename | |
# Append GRUB_SAVEDEFAULT=true after deleting old GRUB_SAVEDEFAULT's | |
echo :: Setting GRUB_SAVEDEFAULT=true | |
sudo sed -i '/GRUB_SAVEDEFAULT=.*/d' $filename | |
sudo sed -i '$aGRUB_SAVEDEFAULT=true' $filename | |
# Update config | |
echo :: Calling update-grub | |
sudo update-grub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment