You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.0 KiB

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