wsl_install.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. util_dir=$(dirname "$0")
  3. dir=$(cd -P -- "$util_dir" && pwd -P)
  4. pushd "$dir";
  5. if [[ $dir != /mnt/* ]];
  6. then
  7. echo
  8. echo "You need to clone the qmk_firmware repository outside the linux filesystem."
  9. echo "Otherwise the windows executables can't be run."
  10. exit 1
  11. fi
  12. while true; do
  13. echo
  14. echo "Do you want to install all toolchain dependencies needed for compiling QMK?"
  15. echo "If you don't want that, you can install the dependencies manually."
  16. read -p "(Y/N) " res
  17. case $res in
  18. [Yy]* ) ./linux_install.sh; break;;
  19. [Nn]* ) break;;
  20. * ) echo "Invalid answer";;
  21. esac
  22. done
  23. download_dir=wsl_downloaded
  24. source "$dir/win_shared_install.sh"
  25. pip3 install -r ${util_dir}/../requirements.txt
  26. echo
  27. echo "Creating a softlink to the utils directory as ~/qmk_utils."
  28. echo "This is needed so that the the make system can find all utils it need."
  29. read -p "Press enter to continue (ctrl-c to abort)"
  30. ln -sfn "$dir" ~/qmk_utils
  31. if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
  32. then
  33. echo
  34. echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
  35. echo "Not adding it twice"
  36. else
  37. while true; do
  38. echo
  39. echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of your"
  40. echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
  41. echo "want to do it automatically, then you have to do it manually later."
  42. read -p "(Y/N)? " res
  43. case $res in
  44. [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;;
  45. [Nn]* ) break;;
  46. * ) echo "Invalid answer";;
  47. esac
  48. done
  49. fi
  50. while true; do
  51. echo
  52. echo "Do you want to add a symlink to the QMK repository in your home directory for"
  53. echo "convenience? This will create a folder 'qmk_firmware' in your home directory."
  54. echo "In the future you can use this folder instead of the full path on your Windows"
  55. echo "file system."
  56. read -p "(Y/N)? " res
  57. case $res in
  58. [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;;
  59. [Nn]* ) break;;
  60. * ) echo "Invalid answer";;
  61. esac
  62. done
  63. echo
  64. echo "******************************************************************************"
  65. echo "Installation completed!"
  66. echo "You need to open a new bash command prompt for all the utils to work properly"
  67. echo "******************************************************************************"
  68. popd > /dev/null