Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "=== GRUB CONFIGURATOR ==="
- echo "Available disks and partitions:"
- lsblk
- read -p "Enter the partition where Windows is installed (e.g., /dev/sda2): " win_partition
- if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root (use sudo)."
- exit 1
- fi
- echo "Removing old 'Install Windows from HDD' entry from GRUB..."
- sed -i '/menuentry "Install Windows from HDD"/,/^}/d' /etc/grub.d/40_custom
- disk=$(echo "$win_partition" | sed 's/[0-9]//g')
- partition=$(echo "$win_partition" | sed 's/[^0-9]//g')
- echo "Adding new Windows entry to GRUB..."
- cat >> /etc/grub.d/40_custom << EOF
- menuentry "Windows" {
- insmod ntfs
- set root=(hd0,$partition)
- chainloader +1
- }
- EOF
- echo "Updating GRUB..."
- update-grub
- echo "Done! Windows entry has been added. Please reboot to apply changes."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement