]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/wsl_install.sh
QMK CLI and JSON keymap support (#6176)
[qmk_firmware.git] / util / wsl_install.sh
1 #!/bin/bash
2
3 util_dir=$(dirname "$0")
4 dir=$(cd -P -- "$util_dir" && pwd -P)
5 pushd "$dir";
6
7 if [[ $dir != /mnt/* ]];
8 then
9     echo
10     echo "You need to clone the qmk_firmware repository outside the linux filesystem."
11     echo "Otherwise the windows executables can't be run."
12     exit 1
13 fi
14
15
16 while true; do
17     echo
18     echo "Do you want to install all toolchain dependencies needed for compiling QMK?"
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]* ) ./linux_install.sh; break;;
23         [Nn]* ) break;;
24         * ) echo "Invalid answer";;
25     esac
26 done
27
28 download_dir=wsl_downloaded
29
30 source "$dir/win_shared_install.sh"
31
32 pip3 install -r ${util_dir}/../requirements.txt
33
34 pushd "$download_dir"
35 while true; do
36     echo
37     echo "Flip need to be installed if you want to use that for programming."
38     echo "Please install it to the default location!"
39     read -p "Do you want to install it now? (Y/N) " res
40     case $res in
41         [Yy]* ) cmd.exe /c FlipInstaller.exe; break;;
42         [Nn]* ) break;;
43         * ) echo "Invalid answer";;
44     esac
45 done
46 popd
47
48
49 echo 
50 echo "Creating a softlink to the utils directory as ~/qmk_utils."
51 echo "This is needed so that the the make system can find all utils it need."
52 read -p "Press enter to continue (ctrl-c to abort)"
53 ln -sfn "$dir" ~/qmk_utils
54
55 if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
56 then
57     echo
58     echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
59     echo "Not adding it twice"
60 else
61     while true; do
62         echo
63         echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of your"
64         echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
65         echo "want to do it automatically, then you have to do it manually later."
66         read -p "(Y/N)? " res
67         case $res in
68             [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;;
69             [Nn]* ) break;;
70             * ) echo "Invalid answer";;
71         esac
72     done
73 fi
74
75 while true; do
76     echo
77     echo "Do you want to add a symlink to the QMK repository in your home directory for"
78     echo "convenience? This will create a folder 'qmk_firmware' in your home directory."
79     echo "In the future you can use this folder instead of the full path on your Windows"
80     echo "file system."
81     read -p "(Y/N)? " res
82     case $res in
83         [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;;
84         [Nn]* ) break;;
85         * ) echo "Invalid answer";;
86     esac
87 done
88
89 echo
90 echo "******************************************************************************"
91 echo "Installation completed!"
92 echo "You need to open a new bash command prompt for all the utils to work properly"
93 echo "******************************************************************************"
94
95 popd > /dev/null