aboutsummaryrefslogtreecommitdiff
path: root/util/msys2_install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'util/msys2_install.sh')
-rw-r--r--util/msys2_install.sh117
1 files changed, 117 insertions, 0 deletions
diff --git a/util/msys2_install.sh b/util/msys2_install.sh
new file mode 100644
index 000000000..de03b89ac
--- /dev/null
+++ b/util/msys2_install.sh
@@ -0,0 +1,117 @@
1#!/bin/bash
2
3dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
4download_dir=~/qmk_utils
5avrtools=avr8-gnu-toolchain
6armtools=gcc-arm-none-eabi
7installflip=false
8
9echo "Installing dependencies needed for the installation (quazip)"
10pacman --needed -S msys/unzip msys/p7zip base-devel msys/git mingw-w64-x86_64-toolchain
11
12source "$dir/win_shared_install.sh"
13
14function install_avr {
15 rm -f -r "$avrtools"
16 wget "http://www.atmel.com/images/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe"
17 7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
18 rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
19}
20
21function install_arm {
22 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"
23 unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip
24 rm gcc-arm-none-eabi.zip
25}
26
27function extract_flip {
28 rm -f -r flip
29 7z -oflip x FlipInstaller.exe
30}
31
32pushd "$download_dir"
33
34if [ -f "FlipInstaller.exe" ]; then
35 echo
36 echo "Extracting flip"
37 extract_flip
38fi
39
40if [ ! -d "$avrtools" ]; then
41 while true; do
42 echo
43 echo "The AVR toolchain is not installed."
44 echo "This is needed for building AVR based keboards."
45 read -p "Do you want to install it? (Y/N) " res
46 case $res in
47 [Yy]* ) install_avr; break;;
48 [Nn]* ) break;;
49 * ) echo "Invalid answer";;
50 esac
51 done
52else
53 while true; do
54 echo
55 echo "The AVR toolchain is already installed"
56 read -p "Do you want to reinstall? (Y/N) " res
57 case $res in
58 [Yy]* ) install_avr; break;;
59 [Nn]* ) break;;
60 * ) echo "Invalid answer";;
61 esac
62 done
63fi
64
65if [ ! -d "$armtools" ]; then
66 while true; do
67 echo
68 echo "The ARM toolchain is not installed."
69 echo "This is needed for building ARM based keboards."
70 read -p "Do you want to install it? (Y/N) " res
71 case $res in
72 [Yy]* ) install_arm; break;;
73 [Nn]* ) break;;
74 * ) echo "Invalid answer";;
75 esac
76 done
77else
78 while true; do
79 echo
80 echo "The ARM toolchain is already installed"
81 read -p "Do you want to reinstall? (Y/N) " res
82 case $res in
83 [Yy]* ) install_arm; break;;
84 [Nn]* ) break;;
85 * ) echo "Invalid answer";;
86 esac
87 done
88fi
89popd
90
91cp -f "$dir/activate_msys2.sh" "$download_dir/"
92
93if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
94then
95 echo
96 echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
97 echo "Not adding it twice!"
98else
99 while true; do
100 echo
101 echo "Do you want to add 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
102 echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
103 echo "want to do it automatically, then you have to do it manually later."
104 read -p "(Y/N)? " res
105 case $res in
106 [Yy]* ) echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; break;;
107 [Nn]* ) break;;
108 * ) echo "Invalid answer";;
109 esac
110 done
111fi
112
113echo
114echo "******************************************************************************"
115echo "Installation completed!"
116echo "Please close this Window and restart MSYS2 MinGW"
117echo "******************************************************************************" \ No newline at end of file