win_shared_install.sh 1.7 KB

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