From 28a4e90565f5ea986401dbd69d74a5a4cc16abab Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 12:24:05 +0300 Subject: Download windows flashing utils and driver_installer --- util/wsl_install.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 util/wsl_install.sh (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh new file mode 100644 index 000000000..87aad7727 --- /dev/null +++ b/util/wsl_install.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +rm -f -r wsl_downloaded +mkdir wsl_downloaded +pushd wsl_downloaded + +echo "Installing dependencies (7z-full, wget)" +echo "This will ask for the sudo password" +sudo apt-get install 7z-full wget + +echo "Installing dfu-programmer" +wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' +7z x -odfu-programmer dfu-programmer-win-0.7.2.zip + +echo "Installing dfu-util" +wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' +7z x dfu-util-0.9-win64.zip + +echo "Installing teensy_loader_cli" +wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' +7z x teensy_loader_cli_windows.zip + +echo "Installing Atmel Flip" +wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' +7z x -oFlip Flip\ Installer\ -\ 3.4.7.112.exe + +echo "Downloading the QMK driver installer" +wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - + +rm -f *.zip +rm Flip\ Installer\ -\ 3.4.7.112.exe +popd + -- cgit v1.2.3 From aa26464480c3080ed935d49cce3f4b9b33c9c05f Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 13:30:53 +0300 Subject: Add checks for cloning to the right dir --- util/wsl_install.sh | 71 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 23 deletions(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 87aad7727..c3aeba6d6 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -1,33 +1,58 @@ #!/bin/bash -rm -f -r wsl_downloaded -mkdir wsl_downloaded -pushd wsl_downloaded +download_dir = wsl_downloaded -echo "Installing dependencies (7z-full, wget)" -echo "This will ask for the sudo password" -sudo apt-get install 7z-full wget +function install_utils { + rm -f -r $download_dir + mkdir $download_dir + + pushd $download_dir + + echo "Installing dfu-programmer" + wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' + 7z x -odfu-programmer dfu-programmer-win-0.7.2.zip + + echo "Installing dfu-util" + wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' + 7z x dfu-util-0.9-win64.zip + + echo "Installing teensy_loader_cli" + wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' + 7z x teensy_loader_cli_windows.zip + + echo "Installing Atmel Flip" + wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' + 7z x -oFlip Flip\ Installer\ -\ 3.4.7.112.exe -echo "Installing dfu-programmer" -wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' -7z x -odfu-programmer dfu-programmer-win-0.7.2.zip + echo "Downloading the QMK driver installer" + wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - + + rm -f *.zip + rm Flip\ Installer\ -\ 3.4.7.112.exe + + popd > /dev/null +} + +function make_environment { +} + +echo "Installing dependencies (p7zip-full, wget)" +echo "This will ask for the sudo password" +sudo apt-get install p7zip-full wget -echo "Installing dfu-util" -wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' -7z x dfu-util-0.9-win64.zip +dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -echo "Installing teensy_loader_cli" -wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' -7z x teensy_loader_cli_windows.zip +if [[ $dir != /mnt/* ]]; +then + echo + echo "You need to clone the qmk_firmware repository outside the linux filesystem." + echo "Otherwise the windows executables can't be run." + exit 1 +fi -echo "Installing Atmel Flip" -wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' -7z x -oFlip Flip\ Installer\ -\ 3.4.7.112.exe +pushd "$dir" -echo "Downloading the QMK driver installer" -wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - +#install_utils -rm -f *.zip -rm Flip\ Installer\ -\ 3.4.7.112.exe -popd +popd > /dev/null -- cgit v1.2.3 From c2096bb5159f3b0d188653cf17cd771725ae7e1a Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 14:42:02 +0300 Subject: Add driver installation --- util/wsl_install.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index c3aeba6d6..9df715b81 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -1,6 +1,6 @@ #!/bin/bash -download_dir = wsl_downloaded +download_dir=wsl_downloaded function install_utils { rm -f -r $download_dir @@ -33,7 +33,11 @@ function install_utils { popd > /dev/null } -function make_environment { +function install_drivers { + pushd $download_dir + cp ../drivers.txt . + cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt + popd > /dev/null } echo "Installing dependencies (p7zip-full, wget)" @@ -54,5 +58,22 @@ pushd "$dir" #install_utils +while true; do + echo + echo "Which USB drivers do you want to install?" + echo "(A)all - All supported drivers will be installed" + echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed" + echo "(F)force - Like all, but will also override existing drivers for connected keyboards" + echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work" + read -p "(A/C/F/N)? " res + case $res in + [Aa]* ) install_drivers --all; break;; + [Cc]* ) install_drivers; break;; + [Ff]* ) install_drivers --all --force; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + popd > /dev/null -- cgit v1.2.3 From 477bd4b948a7399bcb8ba057362c66278e6b3abf Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 14:49:58 +0300 Subject: Add prompt for re-downloading the utils --- util/wsl_install.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 9df715b81..f9c7f6090 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -56,7 +56,19 @@ fi pushd "$dir" -#install_utils +if [ ! -d "$download_dir" ]; then + install_utils +else + while true; do + echo + read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res + case $res in + [Yy]* ) install_utils; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi while true; do echo -- cgit v1.2.3 From 9c582fc797c3fbddd753791aab279dd2ad27b9c4 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 18:26:38 +0300 Subject: Add install dependencies --- util/wsl_install.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index f9c7f6090..0964929e7 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -40,10 +40,6 @@ function install_drivers { popd > /dev/null } -echo "Installing dependencies (p7zip-full, wget)" -echo "This will ask for the sudo password" -sudo apt-get install p7zip-full wget - dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) if [[ $dir != /mnt/* ]]; @@ -56,6 +52,24 @@ fi pushd "$dir" +while true; do + echo + echo "Do you want to install all toolchain dependencies needed for compiling QMK?" + echo "This will run install_dependencies.sh, which calls apt-get upgrade." + echo "If you don't want that, you can install the dependencies manually." + read -p "(Y/N) " res + case $res in + [Yy]* ) sudo ./install_dependencies.sh; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + +echo "Installing dependencies needed for the installation (p7zip-full, wget)" +echo "This will ask for the sudo password" +sudo apt-get install p7zip-full wget + + if [ ! -d "$download_dir" ]; then install_utils else -- cgit v1.2.3 From b8899b48b45c0209e44cc35d9185aa670e769d40 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 20:11:56 +0300 Subject: Make symlink to utils and export programmer variables --- util/wsl_install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 0964929e7..314f520b9 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -35,7 +35,6 @@ function install_utils { function install_drivers { pushd $download_dir - cp ../drivers.txt . cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt popd > /dev/null } @@ -101,5 +100,11 @@ while true; do esac done +echo +echo "Creating a softlink to the utils directory as ~/qmk_utils." +echo "This is needed so that the the make system can find all utils it need." +read -p "Press any key to continue (ctrl-c to abort)" +ln -sf "$dir" ~/qmk_utils + popd > /dev/null -- cgit v1.2.3 From 3d3999d8635d1c9ca5a0276545ce4bdc173aa9a4 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 20:36:27 +0300 Subject: Actually install flip instead of just extracting --- util/wsl_install.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 314f520b9..b1e47d637 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -22,13 +22,12 @@ function install_utils { echo "Installing Atmel Flip" wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' - 7z x -oFlip Flip\ Installer\ -\ 3.4.7.112.exe + mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe echo "Downloading the QMK driver installer" wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - rm -f *.zip - rm Flip\ Installer\ -\ 3.4.7.112.exe popd > /dev/null } @@ -83,6 +82,17 @@ else done fi +while true; do + echo + read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res + case $res in + [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + + while true; do echo echo "Which USB drivers do you want to install?" @@ -106,5 +116,11 @@ echo "This is needed so that the the make system can find all utils it need." read -p "Press any key to continue (ctrl-c to abort)" ln -sf "$dir" ~/qmk_utils +echo +echo "******************************************************************************" +echo "Installation completed!" +echo "You need to open a new batch command prompt for all the utils to work properly" +echo "******************************************************************************" + popd > /dev/null -- cgit v1.2.3 From 3e4f2f5590028851886df54e608d4215883939ba Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 20:43:16 +0300 Subject: Use unzip instead of 7zip --- util/wsl_install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index b1e47d637..645ddce71 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -10,15 +10,15 @@ function install_utils { echo "Installing dfu-programmer" wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' - 7z x -odfu-programmer dfu-programmer-win-0.7.2.zip + unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip echo "Installing dfu-util" wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' - 7z x dfu-util-0.9-win64.zip + unzip dfu-util-0.9-win64.zip echo "Installing teensy_loader_cli" wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' - 7z x teensy_loader_cli_windows.zip + unzip teensy_loader_cli_windows.zip echo "Installing Atmel Flip" wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' @@ -63,9 +63,9 @@ while true; do esac done -echo "Installing dependencies needed for the installation (p7zip-full, wget)" +echo "Installing dependencies needed for the installation (unzip, wget)" echo "This will ask for the sudo password" -sudo apt-get install p7zip-full wget +sudo apt-get install unzip wget if [ ! -d "$download_dir" ]; then -- cgit v1.2.3 From fa4a492677d1435637dceee03302e1bdbd579a2d Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 20:49:42 +0300 Subject: Fix symlink creation --- util/wsl_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 645ddce71..bb2df1b4d 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -114,7 +114,7 @@ echo echo "Creating a softlink to the utils directory as ~/qmk_utils." echo "This is needed so that the the make system can find all utils it need." read -p "Press any key to continue (ctrl-c to abort)" -ln -sf "$dir" ~/qmk_utils +ln -sfn "$dir" ~/qmk_utils echo echo "******************************************************************************" -- cgit v1.2.3 From ec720ac1ea63b3afa2988be06b221d2ed10a2af9 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 21:28:18 +0300 Subject: Add activate_wsl to .bashrc --- util/wsl_install.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index bb2df1b4d..f863c182e 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -116,6 +116,26 @@ echo "This is needed so that the the make system can find all utils it need." read -p "Press any key to continue (ctrl-c to abort)" ln -sfn "$dir" ~/qmk_utils +if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc +then + echo + echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" + echo "Not adding it twice" +else + while true; do + echo + echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" + echo "Without this make won't find the needed utils, so if you don't want to do it automatically," + echo "then you have to do it manually." + read -p "(Y/N)? " res + case $res in + [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi + echo echo "******************************************************************************" echo "Installation completed!" -- cgit v1.2.3 From 999b35c7f8a2fdccf3f8710c2704034bb426b711 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 28 May 2017 21:38:14 +0300 Subject: Create a symlink to qmk if requested --- util/wsl_install.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'util/wsl_install.sh') diff --git a/util/wsl_install.sh b/util/wsl_install.sh index f863c182e..8999da8a4 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -136,6 +136,19 @@ else done fi +while true; do + echo + echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" + echo "This will create a folder 'qmk_firmware' in your home directory." + echo "In the future you can use this folder instead of the full path on your windows file system" + read -p "(Y/N)? " res + case $res in + [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + echo echo "******************************************************************************" echo "Installation completed!" -- cgit v1.2.3