diff --git a/README.md b/README.md index cda3529..fedbd20 100644 --- a/README.md +++ b/README.md @@ -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``. diff --git a/winboot b/winboot index f60b2dc..f921a58 100755 --- a/winboot +++ b/winboot @@ -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