Ensure to define grub's default entry with grub-

This commit is contained in:
Jeremy Gardais 2016-12-20 18:52:25 +01:00
parent 631ff1687f
commit 18ea24d85e
2 changed files with 3 additions and 0 deletions

View File

@ -151,6 +151,7 @@ Be sure to set the correct value to **WIN_GRUB** variable which must be the numb
* The script will also modify the grub configuration: * The script will also modify the grub configuration:
* Set Grub in "saved" mode. * Set Grub in "saved" mode.
* Ensure to set the previous default entry with `grub-set-default`.
* Then for the reboot: * Then for the reboot:
* Choose the grub entry for the next reboot. * Choose the grub entry for the next reboot.
* Reboot the system with ``systemctl``. * Reboot the system with ``systemctl``.

View File

@ -11,6 +11,8 @@ then
else else
printf '%b' "GRUB_DEFAULT is not set in 'saved' mode\n" printf '%b' "GRUB_DEFAULT is not set in 'saved' mode\n"
sudo sed -i 's/\(^GRUB_DEFAULT.*\)/#\1\nGRUB_DEFAULT=saved/' "${GRUB_DEFAULT_PATH}" sudo sed -i 's/\(^GRUB_DEFAULT.*\)/#\1\nGRUB_DEFAULT=saved/' "${GRUB_DEFAULT_PATH}"
GRUB_DEFAULT_ENTRY=$(grep -E -- "#GRUB_DEFAULT=" "${GRUB_DEFAULT_PATH}" | cut -d"=" -f2)
sudo grub-set-default "${GRUB_DEFAULT_ENTRY}"
sudo update-grub sudo update-grub
printf '%b' "Please launch this script once again.\n" printf '%b' "Please launch this script once again.\n"
fi fi