win_shared_install.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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://www.atmel.com/images/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. 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
  37. case $res in
  38. [Yy]* ) install_utils; break;;
  39. [Nn]* ) break;;
  40. * ) echo "Invalid answer";;
  41. esac
  42. done
  43. fi
  44. pushd "$download_dir"
  45. while true; do
  46. echo
  47. 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
  48. case $res in
  49. [Yy]* ) cmd.exe /c FlipInstaller.exe; break;;
  50. [Nn]* ) break;;
  51. * ) echo "Invalid answer";;
  52. esac
  53. done
  54. popd
  55. while true; do
  56. echo
  57. echo "Which USB drivers do you want to install?"
  58. echo "(A)all - All supported drivers will be installed"
  59. echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed"
  60. echo "(F)force - Like all, but will also override existing drivers for connected keyboards"
  61. echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work"
  62. read -p "(A/C/F/N)? " res
  63. case $res in
  64. [Aa]* ) install_drivers --all; break;;
  65. [Cc]* ) install_drivers; break;;
  66. [Ff]* ) install_drivers --all --force; break;;
  67. [Nn]* ) break;;
  68. * ) echo "Invalid answer";;
  69. esac
  70. done
  71. popd > /dev/null