wsl_install.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. download_dir=wsl_downloaded
  27. source "$dir/win_shared_install.sh"
  28. echo
  29. echo "Creating a softlink to the utils directory as ~/qmk_utils."
  30. echo "This is needed so that the the make system can find all utils it need."
  31. read -p "Press any key to continue (ctrl-c to abort)"
  32. ln -sfn "$dir" ~/qmk_utils
  33. if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
  34. then
  35. echo
  36. echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
  37. echo "Not adding it twice"
  38. else
  39. while true; do
  40. echo
  41. echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?"
  42. echo "Without this make won't find the needed utils, so if you don't want to do it automatically,"
  43. echo "then you have to do it manually."
  44. read -p "(Y/N)? " res
  45. case $res in
  46. [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;;
  47. [Nn]* ) break;;
  48. * ) echo "Invalid answer";;
  49. esac
  50. done
  51. fi
  52. while true; do
  53. echo
  54. echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?"
  55. echo "This will create a folder 'qmk_firmware' in your home directory."
  56. echo "In the future you can use this folder instead of the full path on your windows file system"
  57. read -p "(Y/N)? " res
  58. case $res in
  59. [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;;
  60. [Nn]* ) break;;
  61. * ) echo "Invalid answer";;
  62. esac
  63. done
  64. echo
  65. echo "******************************************************************************"
  66. echo "Installation completed!"
  67. echo "You need to open a new batch command prompt for all the utils to work properly"
  68. echo "******************************************************************************"
  69. popd > /dev/null