]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/win_shared_install.sh
f24ec08e8eccd38552ae9cef720d667806782e90
[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     # This URL has changed and I can't find the new location. Commenting out until we figure out the new URL or determine this isn't needed. -skullY
22     echo "Installing Atmel Flip"
23     wget 'http://ww1.microchip.com/downloads/en/DeviceDoc/Flip%20Installer%20-%203.4.7.112.exe'
24     # This is the JRE-less installer, if we need the larger bundled with JRE installer, use this: 
25     #wget 'http://ww1.microchip.com/downloads/en/DeviceDoc/JRE%20-%20Flip%20Installer%20-%203.4.7.112.exe'
26     mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe
27
28     echo "Downloading the QMK driver installer"
29     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 -
30
31     rm -f *.zip
32
33     popd > /dev/null
34 }
35
36 function install_drivers {
37     pushd "$download_dir"
38     cp -f "$dir/drivers.txt" .
39     echo 
40     cmd.exe /c "qmk_driver_installer.exe $1 $2 drivers.txt"
41     popd > /dev/null
42 }
43
44 pushd "$dir"
45
46 if [ ! -d "$download_dir" ]; then
47     install_utils
48 else
49     while true; do
50         echo
51         echo "The utils seem to already be downloaded."
52         read -p "Do you want to re-download them and update to the newest version (Y/N) " res
53         case $res in
54             [Yy]* ) install_utils; break;;
55             [Nn]* ) break;;
56             * ) echo "Invalid answer";;
57         esac
58     done
59 fi
60
61 while true; do
62     echo
63     echo "Which USB drivers do you want to install?"
64     echo "(A)all - All supported drivers will be installed"
65     echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)"
66     echo "              will be installed"
67     echo "(F)force - Like all, but will also override existing drivers for connected"
68     echo "           keyboards"
69     echo "(N)one - No drivers will be installed,"
70     echo "         flashing your keyboard will most likely not work"
71     read -p "(A/C/F/N)? " res
72     case $res in
73         [Aa]* ) install_drivers --all; break;;
74         [Cc]* ) install_drivers; break;;
75         [Ff]* ) install_drivers --all --force; break;;
76         [Nn]* ) break;;
77         * ) echo "Invalid answer";;
78     esac
79 done
80
81
82 popd > /dev/null
83