You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.5 KiB

6 years ago
6 years ago
6 years ago
6 years ago
  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 base-devel msys/git mingw-w64-x86_64-toolchain
  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. cp -f "$dir/activate_msys2.sh" "$download_dir/"
  81. if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
  82. then
  83. echo
  84. echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
  85. echo "Not adding it twice!"
  86. else
  87. while true; do
  88. echo
  89. echo "Do you want to add 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
  90. echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
  91. echo "want to do it automatically, then you have to do it manually later."
  92. read -p "(Y/N)? " res
  93. case $res in
  94. [Yy]* ) echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; break;;
  95. [Nn]* ) break;;
  96. * ) echo "Invalid answer";;
  97. esac
  98. done
  99. fi
  100. echo
  101. echo "******************************************************************************"
  102. echo "Installation completed!"
  103. echo "Please close this Window and restart MSYS2 MinGW"
  104. echo "******************************************************************************"