Rename QK_TMK(_MAX) to QK_BASIC (#6509)
[jackhill/qmk/firmware.git] / util / wsl_install.sh
CommitLineData
28a4e905
FS
1#!/bin/bash
2
a25dd58b 3util_dir=$(dirname "$0")
4dir=$(cd -P -- "$util_dir" && pwd -P)
a2d3fc98 5pushd "$dir";
28a4e905 6
aa264644
FS
7if [[ $dir != /mnt/* ]];
8then
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
13fi
28a4e905 14
28a4e905 15
9c582fc7
FS
16while true; do
17 echo
18 echo "Do you want to install all toolchain dependencies needed for compiling QMK?"
9c582fc7
FS
19 echo "If you don't want that, you can install the dependencies manually."
20 read -p "(Y/N) " res
21 case $res in
11c4c711 22 [Yy]* ) ./linux_install.sh; break;;
9c582fc7
FS
23 [Nn]* ) break;;
24 * ) echo "Invalid answer";;
25 esac
26done
27
d47db637
FS
28download_dir=wsl_downloaded
29
a2d3fc98 30source "$dir/win_shared_install.sh"
3d3999d8 31
a25dd58b 32pip3 install -r ${util_dir}/../requirements.txt
33
0d9e7f63
FS
34pushd "$download_dir"
35while 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
45done
46popd
47
48
86108709
FS
49echo
50echo "Creating a softlink to the utils directory as ~/qmk_utils."
51echo "This is needed so that the the make system can find all utils it need."
7bcf3e27 52read -p "Press enter to continue (ctrl-c to abort)"
86108709
FS
53ln -sfn "$dir" ~/qmk_utils
54
55if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
56then
57 echo
58 echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
59 echo "Not adding it twice"
60else
61 while true; do
62 echo
b85ce4ce
FS
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."
86108709
FS
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
73fi
74
75while true; do
76 echo
b85ce4ce
FS
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."
86108709
FS
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
87done
88
89echo
90echo "******************************************************************************"
91echo "Installation completed!"
7bcf3e27 92echo "You need to open a new bash command prompt for all the utils to work properly"
86108709
FS
93echo "******************************************************************************"
94
aa264644 95popd > /dev/null