]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/msys2_install.sh
Download and extract avr tools
[qmk_firmware.git] / util / msys2_install.sh
1 #!/bin/bash
2
3 dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
4 download_dir=~/qmk_utils
5 avrtools=avr8-gnu-toolchain
6
7 echo "Installing dependencies needed for the installation (quazip)"
8 pacman --needed -S msys/unzip msys/p7zip
9
10
11
12 source "$dir/win_shared_install.sh"
13
14 function 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
21 pushd "$download_dir"
22
23
24 if [ ! -d "$avrtools" ]; then
25     while true; do
26         echo
27         echo "The AVR toolchain is not installed."
28         echo "This is needed for building AVR based keboards."
29         read -p "Do you want to install it? (Y/N) " res
30         case $res in
31             [Yy]* ) install_avr; break;;
32             [Nn]* ) break;;
33             * ) echo "Invalid answer";;
34         esac
35     done
36 else
37     while true; do
38         echo
39         echo "The AVR toolchain is already installed"
40         read -p "Do you want to reinstall? (Y/N) " res
41         case $res in
42             [Yy]* ) install_avr; break;;
43             [Nn]* ) break;;
44             * ) echo "Invalid answer";;
45         esac
46     done
47 fi
48 popd
49
50 echo
51 echo "******************************************************************************"
52 echo "Installation completed!"
53 echo "You need to open a new batch command prompt for all the utils to work properly"
54 echo "******************************************************************************"