wsl_install.sh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. download_dir=wsl_downloaded
  3. function install_utils {
  4. rm -f -r $download_dir
  5. mkdir $download_dir
  6. pushd $download_dir
  7. echo "Installing dfu-programmer"
  8. wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip'
  9. 7z x -odfu-programmer dfu-programmer-win-0.7.2.zip
  10. echo "Installing dfu-util"
  11. wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip'
  12. 7z x dfu-util-0.9-win64.zip
  13. echo "Installing teensy_loader_cli"
  14. wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
  15. 7z x teensy_loader_cli_windows.zip
  16. echo "Installing Atmel Flip"
  17. wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe'
  18. 7z x -oFlip Flip\ Installer\ -\ 3.4.7.112.exe
  19. echo "Downloading the QMK driver installer"
  20. 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 -
  21. rm -f *.zip
  22. rm Flip\ Installer\ -\ 3.4.7.112.exe
  23. popd > /dev/null
  24. }
  25. function install_drivers {
  26. pushd $download_dir
  27. cp ../drivers.txt .
  28. cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt
  29. popd > /dev/null
  30. }
  31. echo "Installing dependencies (p7zip-full, wget)"
  32. echo "This will ask for the sudo password"
  33. sudo apt-get install p7zip-full wget
  34. dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  35. if [[ $dir != /mnt/* ]];
  36. then
  37. echo
  38. echo "You need to clone the qmk_firmware repository outside the linux filesystem."
  39. echo "Otherwise the windows executables can't be run."
  40. exit 1
  41. fi
  42. pushd "$dir"
  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. while true; do
  57. echo
  58. echo "Which USB drivers do you want to install?"
  59. echo "(A)all - All supported drivers will be installed"
  60. echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed"
  61. echo "(F)force - Like all, but will also override existing drivers for connected keyboards"
  62. echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work"
  63. read -p "(A/C/F/N)? " res
  64. case $res in
  65. [Aa]* ) install_drivers --all; break;;
  66. [Cc]* ) install_drivers; break;;
  67. [Ff]* ) install_drivers --all --force; break;;
  68. [Nn]* ) break;;
  69. * ) echo "Invalid answer";;
  70. esac
  71. done
  72. popd > /dev/null