Advertisement
ciusss89

VaioBootRecover.sh

Jun 4th, 2013
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.41 KB | None | 0 0
  1. # http://forums.debian.net/viewtopic.php?f=16&t=81120
  2. # http://forum.notebookreview.com/sony/693039-tutorial-vaio-efi-dual-boot-tutorial.html
  3. # http://askubuntu.com/questions/150174/sony-vaio-with-insyde-h2o-efi-bios-will-not-boot-into-grub-efi
  4. #!/bin/bash
  5. clear;sudo blkid; path="CHROOT-RECOVERY"
  6. echo "Script for fixing boot of Sony Vaio S series laptop whit Insyde H2O BIOS EFI"
  7. read -p "Type root partition > " root_part
  8. read -p "Type boot partition > " boot_part
  9. echo "Root is $root_part  Boot is $boot_part"
  10.  
  11. read -p " continue (yes/not)> " s1
  12. s2="yes"
  13.  
  14. if [ "x$s1" == "x$s2" ]
  15. then
  16.         mkdir -p $path
  17.         sudo mount $root_part $path; sleep 1;
  18.         sudo mount $boot_part $path/boot/efi/; sleep 1
  19.     #sudo cp -rp /lib/modules/* CHROOT-RECOVERY/lib/modules/
  20.  
  21.         sudo mount -o bind /dev $path/dev/; sleep 1
  22.         sudo mount -t proc proc $path/proc/; sleep 1
  23.         sudo mount -t devpts devpts $path/dev/pts; sleep 1
  24.         sudo mount -t sysfs sys $path/sys/; sleep 1
  25.     sudo mount --bind /sys/firmware/efi/efivars $path/sys/firmware/efi/efivars; sleep 1
  26.     sudo cp -v /etc/resolv.conf $path/etc/
  27.  
  28.     echo "********************************************************************"
  29.     echo "LOADED BY MOUNT: efivars, sysy, devpts, proc, dev"
  30.     echo "BEFORE TO START MAKE BACKUP OF ./EFI/Microsoft partitions"
  31.     echo "0)    cp -rpv boot/efi/EFI/Microsoft /tmp/"
  32.     echo "1)    rm -rf boot/efi/EFI"
  33.     echo "2)    apt-get remove --purge grub-*"
  34.     echo "3)    rm -rf boot/grub"
  35.     echo "4)    apt-get install grub-efi-amd64"
  36.     echo "5)    efibootmgr -O"
  37.     echo "6)    grub-install $boot_part"
  38.     echo "7)    update-grub2"
  39.     echo "8)    mkdir /boot/efi/EFI/boot"
  40.     echo "9)    cp -v /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/boot/bootx64.efi"
  41.     echo "10)   rm -rf /boot/efi/EFI/debian"
  42.     echo "11)   cp -rpv /tmp/Microsoft /boot/efi/EFI/Microsoft"
  43.     echo "12)   mv /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/Boot/bootx64.efi.grb"
  44.     echo "13)   grub-probe --target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootx64.efi.grb"
  45.     echo "14)   "
  46.     echo "********************************************************************"
  47.  
  48.     sudo chroot $path /bin/bash
  49.  
  50.     sudo umount $path/sys/firmware/efi/efivars
  51.         sudo umount $path/dev/pts/
  52.         sudo umount $path/proc/
  53.         sudo umount $path/dev/
  54.         sudo umount $path/sys/
  55.  
  56.         sleep 1
  57.         sudo umount $boot_part; sleep 1
  58.         sudo umount $root_part
  59. fi
  60.  
  61. # Giuseppe Tipaldi.
  62. # Gen.2014
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement