win_shared_install.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. function install_utils {
  3. rm -f -r "$download_dir"
  4. mkdir "$download_dir"
  5. pushd "$download_dir"
  6. echo "Installing dfu-programmer"
  7. wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip'
  8. unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip
  9. echo "Installing dfu-util"
  10. wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip'
  11. unzip dfu-util-0.9-win64.zip
  12. echo "Installing teensy_loader_cli"
  13. wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
  14. unzip teensy_loader_cli_windows.zip
  15. echo "Downloading the QMK driver installer"
  16. 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 -
  17. rm -f *.zip
  18. popd > /dev/null
  19. }
  20. function install_drivers {
  21. pushd "$download_dir"
  22. cp -f "$dir/drivers.txt" .
  23. echo
  24. cmd.exe //c "qmk_driver_installer.exe $1 $2 drivers.txt"
  25. popd > /dev/null
  26. }
  27. pushd "$dir"
  28. if [ ! -d "$download_dir" ]; then
  29. install_utils
  30. else
  31. while true; do
  32. echo
  33. echo "The utils seem to already be downloaded."
  34. read -p "Do you want to re-download them and update to the newest version (Y/N) " res
  35. case $res in
  36. [Yy]* ) install_utils; break;;
  37. [Nn]* ) break;;
  38. * ) echo "Invalid answer";;
  39. esac
  40. done
  41. fi
  42. while true; do
  43. echo
  44. echo "Which USB drivers do you want to install?"
  45. echo "(A)ll - All supported drivers will be installed"
  46. echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)"
  47. echo " will be installed"
  48. echo "(F)orce - Like all, but will also override existing drivers for connected"
  49. echo " keyboards"
  50. echo "(N)one - No drivers will be installed,"
  51. echo " flashing your keyboard will most likely not work"
  52. read -p "(a/c/f/N)? " res
  53. case $res in
  54. [AaYy]* ) install_drivers --all; break;;
  55. [Cc]* ) install_drivers; break;;
  56. [Ff]* ) install_drivers --all --force; break;;
  57. [Nn]* | "" ) break;;
  58. * ) echo "Invalid answer";;
  59. esac
  60. done
  61. popd > /dev/null