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