wsl_install.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  3. pushd "$dir";
  4. if [[ $dir != /mnt/* ]];
  5. then
  6. echo
  7. echo "You need to clone the qmk_firmware repository outside the linux filesystem."
  8. echo "Otherwise the windows executables can't be run."
  9. exit 1
  10. fi
  11. while true; do
  12. echo
  13. echo "Do you want to install all toolchain dependencies needed for compiling QMK?"
  14. echo "This will run install_dependencies.sh, which calls apt-get upgrade."
  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]* ) sudo ./install_dependencies.sh; break;;
  19. [Nn]* ) break;;
  20. * ) echo "Invalid answer";;
  21. esac
  22. done
  23. echo "Installing dependencies needed for the installation (unzip, wget)"
  24. echo "This will ask for the sudo password"
  25. sudo apt-get install unzip wget
  26. source "$dir/win_shared_install.sh"
  27. echo
  28. echo "Creating a softlink to the utils directory as ~/qmk_utils."
  29. echo "This is needed so that the the make system can find all utils it need."
  30. read -p "Press any key to continue (ctrl-c to abort)"
  31. ln -sfn "$dir" ~/qmk_utils
  32. if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
  33. then
  34. echo
  35. echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
  36. echo "Not adding it twice"
  37. else
  38. while true; do
  39. echo
  40. echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?"
  41. echo "Without this make won't find the needed utils, so if you don't want to do it automatically,"
  42. echo "then you have to do it manually."
  43. read -p "(Y/N)? " res
  44. case $res in
  45. [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;;
  46. [Nn]* ) break;;
  47. * ) echo "Invalid answer";;
  48. esac
  49. done
  50. fi
  51. while true; do
  52. echo
  53. echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?"
  54. echo "This will create a folder 'qmk_firmware' in your home directory."
  55. echo "In the future you can use this folder instead of the full path on your windows 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 batch command prompt for all the utils to work properly"
  67. echo "******************************************************************************"
  68. popd > /dev/null