You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.4 KiB

  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 "Installing Atmel Flip"
  16. wget 'http://ww1.microchip.com/downloads/en/DeviceDoc/Flip%20Installer%20-%203.4.7.112.exe'
  17. mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe
  18. echo "Downloading the QMK driver installer"
  19. 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 -
  20. rm -f *.zip
  21. popd > /dev/null
  22. }
  23. function install_drivers {
  24. pushd "$download_dir"
  25. cp -f "$dir/drivers.txt" .
  26. echo
  27. cmd.exe /c "qmk_driver_installer.exe $1 $2 drivers.txt"
  28. popd > /dev/null
  29. }
  30. pushd "$dir"
  31. if [ ! -d "$download_dir" ]; then
  32. install_utils
  33. else
  34. while true; do
  35. echo
  36. echo "The utils seem to already be downloaded."
  37. read -p "Do you want to re-download them and update to the newest version (Y/N) " res
  38. case $res in
  39. [Yy]* ) install_utils; break;;
  40. [Nn]* ) break;;
  41. * ) echo "Invalid answer";;
  42. esac
  43. done
  44. fi
  45. while true; do
  46. echo
  47. echo "Which USB drivers do you want to install?"
  48. echo "(A)all - All supported drivers will be installed"
  49. echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)"
  50. echo " will be installed"
  51. echo "(F)force - Like all, but will also override existing drivers for connected"
  52. echo " keyboards"
  53. echo "(N)one - No drivers will be installed,"
  54. echo " flashing your keyboard will most likely not work"
  55. read -p "(A/C/F/N)? " res
  56. case $res in
  57. [Aa]* ) install_drivers --all; break;;
  58. [Cc]* ) install_drivers; break;;
  59. [Ff]* ) install_drivers --all --force; break;;
  60. [Nn]* ) break;;
  61. * ) echo "Invalid answer";;
  62. esac
  63. done
  64. popd > /dev/null