3 download_dir=wsl_downloaded
5 function install_utils {
11 echo "Installing dfu-programmer"
12 wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip'
13 unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip
15 echo "Installing dfu-util"
16 wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip'
17 unzip dfu-util-0.9-win64.zip
19 echo "Installing teensy_loader_cli"
20 wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
21 unzip teensy_loader_cli_windows.zip
23 echo "Installing Atmel Flip"
24 wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe'
25 mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe
27 echo "Downloading the QMK driver installer"
28 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 -
35 function install_drivers {
37 cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt
41 dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
43 if [[ $dir != /mnt/* ]];
46 echo "You need to clone the qmk_firmware repository outside the linux filesystem."
47 echo "Otherwise the windows executables can't be run."
55 echo "Do you want to install all toolchain dependencies needed for compiling QMK?"
56 echo "This will run install_dependencies.sh, which calls apt-get upgrade."
57 echo "If you don't want that, you can install the dependencies manually."
60 [Yy]* ) sudo ./install_dependencies.sh; break;;
62 * ) echo "Invalid answer";;
66 echo "Installing dependencies needed for the installation (unzip, wget)"
67 echo "This will ask for the sudo password"
68 sudo apt-get install unzip wget
71 if [ ! -d "$download_dir" ]; then
76 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
78 [Yy]* ) install_utils; break;;
80 * ) echo "Invalid answer";;
87 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
89 [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;;
91 * ) echo "Invalid answer";;
98 echo "Which USB drivers do you want to install?"
99 echo "(A)all - All supported drivers will be installed"
100 echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed"
101 echo "(F)force - Like all, but will also override existing drivers for connected keyboards"
102 echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work"
103 read -p "(A/C/F/N)? " res
105 [Aa]* ) install_drivers --all; break;;
106 [Cc]* ) install_drivers; break;;
107 [Ff]* ) install_drivers --all --force; break;;
109 * ) echo "Invalid answer";;
114 echo "Creating a softlink to the utils directory as ~/qmk_utils."
115 echo "This is needed so that the the make system can find all utils it need."
116 read -p "Press any key to continue (ctrl-c to abort)"
117 ln -sfn "$dir" ~/qmk_utils
119 if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
122 echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
123 echo "Not adding it twice"
127 echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?"
128 echo "Without this make won't find the needed utils, so if you don't want to do it automatically,"
129 echo "then you have to do it manually."
130 read -p "(Y/N)? " res
132 [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;;
134 * ) echo "Invalid answer";;
141 echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?"
142 echo "This will create a folder 'qmk_firmware' in your home directory."
143 echo "In the future you can use this folder instead of the full path on your windows file system"
144 read -p "(Y/N)? " res
146 [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;;
148 * ) echo "Invalid answer";;
153 echo "******************************************************************************"
154 echo "Installation completed!"
155 echo "You need to open a new batch command prompt for all the utils to work properly"
156 echo "******************************************************************************"