msys2_install.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. installflip=false
  7. echo "Installing dependencies needed for the installation (quazip)"
  8. pacman --needed -S msys/unzip msys/p7zip
  9. source "$dir/win_shared_install.sh"
  10. function install_avr {
  11. rm -f -r "$avrtools"
  12. wget "http://www.atmel.com/images/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe"
  13. 7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
  14. rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
  15. }
  16. function install_arm {
  17. 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"
  18. unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip
  19. rm gcc-arm-none-eabi.zip
  20. }
  21. function extract_flip {
  22. rm -f -r flip
  23. 7z -oflip x FlipInstaller.exe
  24. }
  25. pushd "$download_dir"
  26. if [ -f "FlipInstaller.exe" ]; then
  27. echo
  28. echo "Extracting flip"
  29. extract_flip
  30. fi
  31. if [ ! -d "$avrtools" ]; then
  32. while true; do
  33. echo
  34. echo "The AVR toolchain is not installed."
  35. echo "This is needed for building AVR based keboards."
  36. read -p "Do you want to install it? (Y/N) " res
  37. case $res in
  38. [Yy]* ) install_avr; break;;
  39. [Nn]* ) break;;
  40. * ) echo "Invalid answer";;
  41. esac
  42. done
  43. else
  44. while true; do
  45. echo
  46. echo "The AVR toolchain is already installed"
  47. read -p "Do you want to reinstall? (Y/N) " res
  48. case $res in
  49. [Yy]* ) install_avr; break;;
  50. [Nn]* ) break;;
  51. * ) echo "Invalid answer";;
  52. esac
  53. done
  54. fi
  55. if [ ! -d "$armtools" ]; then
  56. while true; do
  57. echo
  58. echo "The ARM toolchain is not installed."
  59. echo "This is needed for building ARM based keboards."
  60. read -p "Do you want to install it? (Y/N) " res
  61. case $res in
  62. [Yy]* ) install_arm; break;;
  63. [Nn]* ) break;;
  64. * ) echo "Invalid answer";;
  65. esac
  66. done
  67. else
  68. while true; do
  69. echo
  70. echo "The ARM toolchain is already installed"
  71. read -p "Do you want to reinstall? (Y/N) " res
  72. case $res in
  73. [Yy]* ) install_arm; break;;
  74. [Nn]* ) break;;
  75. * ) echo "Invalid answer";;
  76. esac
  77. done
  78. fi
  79. popd
  80. echo
  81. echo "******************************************************************************"
  82. echo "Installation completed!"
  83. echo "You need to open a new batch command prompt for all the utils to work properly"
  84. echo "******************************************************************************"