msys2_install.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  3. download_dir=~/qmk_utils
  4. avrtools=avr8-gnu-toolchain
  5. armtools=gcc-arm-none-eabi
  6. echo "Installing dependencies needed for the installation (quazip)"
  7. pacman --needed -S msys/unzip msys/p7zip
  8. source "$dir/win_shared_install.sh"
  9. function install_avr {
  10. rm -f -r "$avrtools"
  11. wget "http://www.atmel.com/images/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe"
  12. 7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
  13. rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
  14. }
  15. function install_arm {
  16. wget -O gcc-arm-none-eabi.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip?product=GNU%20ARM%20Embedded%20Toolchain,ZIP,,Windows,6-2017-q2-update"
  17. unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip
  18. rm gcc-arm-none-eabi.zip
  19. }
  20. pushd "$download_dir"
  21. if [ ! -d "$avrtools" ]; then
  22. while true; do
  23. echo
  24. echo "The AVR toolchain is not installed."
  25. echo "This is needed for building AVR based keboards."
  26. read -p "Do you want to install it? (Y/N) " res
  27. case $res in
  28. [Yy]* ) install_avr; break;;
  29. [Nn]* ) break;;
  30. * ) echo "Invalid answer";;
  31. esac
  32. done
  33. else
  34. while true; do
  35. echo
  36. echo "The AVR toolchain is already installed"
  37. read -p "Do you want to reinstall? (Y/N) " res
  38. case $res in
  39. [Yy]* ) install_avr; break;;
  40. [Nn]* ) break;;
  41. * ) echo "Invalid answer";;
  42. esac
  43. done
  44. fi
  45. if [ ! -d "$armtools" ]; then
  46. while true; do
  47. echo
  48. echo "The ARM toolchain is not installed."
  49. echo "This is needed for building ARM based keboards."
  50. read -p "Do you want to install it? (Y/N) " res
  51. case $res in
  52. [Yy]* ) install_arm; break;;
  53. [Nn]* ) break;;
  54. * ) echo "Invalid answer";;
  55. esac
  56. done
  57. else
  58. while true; do
  59. echo
  60. echo "The ARM toolchain is already installed"
  61. read -p "Do you want to reinstall? (Y/N) " res
  62. case $res in
  63. [Yy]* ) install_arm; break;;
  64. [Nn]* ) break;;
  65. * ) echo "Invalid answer";;
  66. esac
  67. done
  68. fi
  69. popd
  70. echo
  71. echo "******************************************************************************"
  72. echo "Installation completed!"
  73. echo "You need to open a new batch command prompt for all the utils to work properly"
  74. echo "******************************************************************************"