]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/win_shared_install.sh
Use home directory for download on msys2
[qmk_firmware.git] / util / win_shared_install.sh
1 #!/bin/bash
2
3 function install_utils {
4     rm -f -r "$download_dir"
5     mkdir "$download_dir"
6
7     pushd "$download_dir"
8
9     echo "Installing dfu-programmer"
10     wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip'
11     unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip
12
13     echo "Installing dfu-util"
14     wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip'
15     unzip dfu-util-0.9-win64.zip
16
17     echo "Installing teensy_loader_cli"
18     wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
19     unzip teensy_loader_cli_windows.zip
20
21     echo "Installing Atmel Flip"
22     wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe'
23     mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe
24
25     echo "Downloading the QMK driver installer"
26     wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i -
27
28     rm -f *.zip
29
30     popd > /dev/null
31 }
32
33 function install_drivers {
34     pushd "$download_dir"
35     cp -f "$dir/drivers.txt" .
36     echo 
37     cmd.exe /c "qmk_driver_installer.exe $1 $2 drivers.txt"
38     popd > /dev/null
39 }
40
41 pushd "$dir"
42
43 if [ ! -d "$download_dir" ]; then
44     install_utils
45 else
46     while true; do
47         echo
48         read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res
49         case $res in
50             [Yy]* ) install_utils; break;;
51             [Nn]* ) break;;
52             * ) echo "Invalid answer";;
53         esac
54     done
55 fi
56
57 pushd "$download_dir"
58 while true; do
59     echo
60     read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res
61     case $res in
62         [Yy]* ) cmd.exe /c FlipInstaller.exe; break;;
63         [Nn]* ) break;;
64         * ) echo "Invalid answer";;
65     esac
66 done
67 popd
68
69
70 while true; do
71     echo
72     echo "Which USB drivers do you want to install?"
73     echo "(A)all - All supported drivers will be installed"
74     echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed"
75     echo "(F)force - Like all, but will also override existing drivers for connected keyboards"
76     echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work"
77     read -p "(A/C/F/N)? " res
78     case $res in
79         [Aa]* ) install_drivers --all; break;;
80         [Cc]* ) install_drivers; break;;
81         [Ff]* ) install_drivers --all --force; break;;
82         [Nn]* ) break;;
83         * ) echo "Invalid answer";;
84     esac
85 done
86
87
88 popd > /dev/null
89