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