Ensure to define grub's default entry with grub-

This commit is contained in:
gardouille 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:
* Set Grub in "saved" mode.
* Ensure to set the previous default entry with `grub-set-default`.
* Then for the reboot:
* Choose the grub entry for the next reboot.
* Reboot the system with ``systemctl``.

View File

@ -11,6 +11,8 @@ then
else
printf '%b' "GRUB_DEFAULT is not set in 'saved' mode\n"
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
printf '%b' "Please launch this script once again.\n"
fi