win_shared_install.sh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. download_dir=win_downloaded
  3. wsl_download_dir=wsl_downloaded
  4. function install_utils {
  5. rm -f -r $download_dir
  6. mkdir $download_dir
  7. pushd $download_dir
  8. echo "Installing dfu-programmer"
  9. wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip'
  10. unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip
  11. echo "Installing dfu-util"
  12. wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip'
  13. unzip dfu-util-0.9-win64.zip
  14. echo "Installing teensy_loader_cli"
  15. wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
  16. unzip teensy_loader_cli_windows.zip
  17. echo "Installing Atmel Flip"
  18. wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe'
  19. mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe
  20. echo "Downloading the QMK driver installer"
  21. 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 -
  22. rm -f *.zip
  23. popd > /dev/null
  24. }
  25. function install_drivers {
  26. pushd $download_dir
  27. echo
  28. cmd.exe /c "qmk_driver_installer.exe $1 $2 ..\\drivers.txt"
  29. popd > /dev/null
  30. }
  31. pushd "$dir"
  32. if [ -d "$wsl_download_dir" ]; then
  33. echo "Renaming existing wsl_download_dir to win_download"
  34. mv -f "$wsl_download_dir" "$download_dir"
  35. fi
  36. if [ ! -d "$download_dir" ]; then
  37. install_utils
  38. else
  39. while true; do
  40. echo
  41. 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
  42. case $res in
  43. [Yy]* ) install_utils; break;;
  44. [Nn]* ) break;;
  45. * ) echo "Invalid answer";;
  46. esac
  47. done
  48. fi
  49. while true; do
  50. echo
  51. 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
  52. case $res in
  53. [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;;
  54. [Nn]* ) break;;
  55. * ) echo "Invalid answer";;
  56. esac
  57. done
  58. while true; do
  59. echo
  60. echo "Which USB drivers do you want to install?"
  61. echo "(A)all - All supported drivers will be installed"
  62. echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed"
  63. echo "(F)force - Like all, but will also override existing drivers for connected keyboards"
  64. echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work"
  65. read -p "(A/C/F/N)? " res
  66. case $res in
  67. [Aa]* ) install_drivers --all; break;;
  68. [Cc]* ) install_drivers; break;;
  69. [Ff]* ) install_drivers --all --force; break;;
  70. [Nn]* ) break;;
  71. * ) echo "Invalid answer";;
  72. esac
  73. done
  74. popd > /dev/null