Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "=== WINDOWS ISO INSTALLER FOR LINUX BY CHATGPT, ROMAN AMOGUS ==="
- echo "Available disks and partitions:"
- lsblk
- read -p "Enter the FULL path to the Windows ISO: " iso_path
- read -p "Enter the device/partition where Windows should be installed (e.g., /dev/sda2): " win_partition
- read -p "Enter the disk where GRUB should be installed (e.g., /dev/sda): " grub_disk
- if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root (use sudo)."
- exit 1
- fi
- echo "Mounting ISO and partition..."
- mkdir -p /mnt/winiso /mnt/winpart
- mount "$iso_path" /mnt/winiso
- mount "$win_partition" /mnt/winpart
- echo "Copying ISO contents to the Windows partition..."
- cp -rT /mnt/winiso /mnt/winpart
- echo "Installing GRUB to disk $grub_disk..."
- grub-install --target=i386-pc "$grub_disk"
- update-grub
- echo "Adding Windows installer entry to GRUB..."
- cat >> /etc/grub.d/40_custom << EOF
- menuentry "Install Windows from HDD" {
- insmod ntfs
- search --no-floppy --file /bootmgr --set=root
- chainloader +1
- }
- EOF
- update-grub
- echo "Done! Reboot and select 'Install Windows from HDD' in GRUB."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement