scripts/winboot

19 lines
462 B
Plaintext
Raw Normal View History

2016-12-19 17:45:17 +01:00
#!/bin/sh
GRUB_DEFAULT_PATH='/etc/default/grub'
WIN_GRUB="2"
if grep -q -E -- "^GRUB_DEFAULT=saved" "${GRUB_DEFAULT_PATH}"
then
printf '%b' "Reboot to windaube partition\n"
sudo grub-reboot "${WIN_GRUB}"
sudo systemctl reboot
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}"
sudo update-grub
printf '%b' "Please launch this script once again.\n"
fi
exit 0