From f0a1ab5488425857987e94c883fd13cc661a92a8 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 18 Oct 2020 02:45:21 +1100 Subject: [PATCH] MSYS and WSL installation improvements (#10593) --- docs/driver_installation_zadig.md | 2 +- util/activate_msys2.sh | 8 ---- util/activate_wsl.sh | 8 ---- util/linux_install.sh | 14 ++++++ util/msys2_install.sh | 31 ++++-------- util/qmk_install.sh | 10 ++-- util/win_shared_install.sh | 63 ------------------------ util/wsl_install.sh | 80 ------------------------------- 8 files changed, 29 insertions(+), 187 deletions(-) delete mode 100755 util/activate_msys2.sh delete mode 100755 util/activate_wsl.sh delete mode 100755 util/win_shared_install.sh delete mode 100755 util/wsl_install.sh diff --git a/docs/driver_installation_zadig.md b/docs/driver_installation_zadig.md index 403b78da0ce..4519a21e6b5 100644 --- a/docs/driver_installation_zadig.md +++ b/docs/driver_installation_zadig.md @@ -4,7 +4,7 @@ QMK presents itself to the host as a regular HID keyboard device, and as such re There are two notable exceptions: the Caterina bootloader, usually seen on Pro Micros, and the HalfKay bootloader shipped with PJRC Teensys, appear as a serial port and a generic HID device respectively, and so do not require a driver. -We recommend the use of the [Zadig](https://zadig.akeo.ie/) utility. If you have set up the development environment with MSYS2 or WSL, the `qmk_install.sh` script will have asked if you want it to install the drivers for you. +We recommend the use of the [Zadig](https://zadig.akeo.ie/) utility. If you have set up the development environment with MSYS2, the `qmk_install.sh` script will have already installed the drivers for you. ## Installation diff --git a/util/activate_msys2.sh b/util/activate_msys2.sh deleted file mode 100755 index b37bee8597d..00000000000 --- a/util/activate_msys2.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -function export_variables { - local util_dir=~/qmk_utils - export PATH=$PATH:$util_dir -} - -export_variables diff --git a/util/activate_wsl.sh b/util/activate_wsl.sh deleted file mode 100755 index 45cd945efb9..00000000000 --- a/util/activate_wsl.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -function export_variables { - local util_dir=~/qmk_utils - local download_dir=$util_dir/wsl_downloaded -} - -export_variables diff --git a/util/linux_install.sh b/util/linux_install.sh index 0343b07e6f6..fb8968386b8 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -235,3 +235,17 @@ fi # Global install tasks install_bootloadhid pip3 install --user -r ${util_dir}/../requirements.txt + +if uname -a | grep -qi microsoft; then + echo "********************************************************************************" + echo "* Detected Windows Subsystem for Linux. *" + echo "* Currently, WSL has no access to USB devices and so flashing from within the *" + echo "* WSL terminal will not work. *" + echo "* *" + echo "* Please install the QMK Toolbox instead: *" + echo "* https://github.com/qmk/qmk_toolbox/releases *" + echo "* Then, map your WSL filesystem as a network drive: *" + echo "* \\\\\\\\wsl$\\ *" + echo "********************************************************************************" + echo +fi diff --git a/util/msys2_install.sh b/util/msys2_install.sh index c223e52faee..5abe4a597b8 100755 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -1,7 +1,5 @@ #!/bin/bash -dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -download_dir=~/qmk_utils util_dir=$(dirname "$0") echo "Installing dependencies needed for the installation" @@ -12,26 +10,13 @@ pacman --needed --noconfirm --disable-download-timeout -Sy \ mingw-w64-x86_64-arm-none-eabi-binutils mingw-w64-x86_64-arm-none-eabi-gcc mingw-w64-x86_64-arm-none-eabi-newlib \ mingw-w64-x86_64-avrdude mingw-w64-x86_64-bootloadhid mingw-w64-x86_64-dfu-programmer mingw-w64-x86_64-dfu-util mingw-w64-x86_64-teensy-loader-cli -source "$dir/win_shared_install.sh" +echo "Installing drivers" +tmpdir=$(mktemp -d) +cp "${util_dir}/drivers.txt" $tmpdir +pushd $tmpdir > /dev/null +wget "https://github.com/qmk/qmk_driver_installer/releases/download/v1.01/qmk_driver_installer.exe" +cmd.exe //c "qmk_driver_installer.exe --all --force drivers.txt" +popd > /dev/null +rm -r $tmpdir pip3 install -r "${util_dir}/../requirements.txt" - -cp -f "$dir/activate_msys2.sh" "$download_dir/" - -if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc -then - echo - echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc" - echo "Not adding it twice!" -else - echo - echo "Adding 'source ~/qmk_utils/activate_msys2.sh' to the end of your" - echo ".bashrc file. Without this make won't find the needed utils." - echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; -fi - -echo -echo "******************************************************************************" -echo "Installation completed!" -echo "Please close this Window and restart MSYS2 MinGW" -echo "******************************************************************************" diff --git a/util/qmk_install.sh b/util/qmk_install.sh index 76ecf5fc01d..714ee914454 100755 --- a/util/qmk_install.sh +++ b/util/qmk_install.sh @@ -7,19 +7,21 @@ case $(uname -a) in *Darwin*) exec "${util_dir}/macos_install.sh" ;; - *Linux*Microsoft*) - exec "${util_dir}/wsl_install.sh" - ;; *FreeBSD*) exec "${util_dir}/freebsd_install.sh" ;; *Linux*) exec "${util_dir}/linux_install.sh" ;; - MSYS_NT*|MINGW64_NT*|MINGW32_NT*) + MINGW64_NT*) exec "${util_dir}/msys2_install.sh" ;; + MSYS_NT*|MINGW32_NT*) + echo "Please open a MinGW 64-bit terminal window and re-run this script." + exit 1 + ;; *) echo "Environment not supported. Please see https://docs.qmk.fm for details on how to configure the QMK Firmware build tools manually." + exit 1 ;; esac diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh deleted file mode 100755 index f45ca35170e..00000000000 --- a/util/win_shared_install.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -function install_utils { - rm -f -r "$download_dir" - mkdir "$download_dir" - - pushd "$download_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 - - - rm -f *.zip - - popd > /dev/null -} - -function install_drivers { - pushd "$download_dir" - cp -f "$dir/drivers.txt" . - echo - cmd.exe //c "qmk_driver_installer.exe $1 $2 drivers.txt" - popd > /dev/null -} - -pushd "$dir" - -if [ ! -d "$download_dir" ]; then - install_utils -else - while true; do - echo - echo "The utils seem to already be downloaded." - read -p "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 - echo "Which USB drivers do you want to install?" - echo "(A)ll - All supported drivers will be installed" - echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)" - echo " will be installed" - echo "(F)orce - Like all, but will also override existing drivers for connected" - echo " keyboards" - echo "(N)one - No drivers will be installed," - echo " flashing your keyboard will most likely not work" - read -p "(a/c/f/N)? " res - case $res in - [AaYy]* ) install_drivers --all; break;; - [Cc]* ) install_drivers; break;; - [Ff]* ) install_drivers --all --force; break;; - [Nn]* | "" ) break;; - * ) echo "Invalid answer";; - esac -done - - -popd > /dev/null diff --git a/util/wsl_install.sh b/util/wsl_install.sh deleted file mode 100755 index 8ed177ca3e9..00000000000 --- a/util/wsl_install.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -util_dir=$(dirname "$0") -dir=$(cd -P -- "$util_dir" && pwd -P) -pushd "$dir"; - -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 - - -while true; do - echo - echo "Do you want to install all toolchain dependencies needed for compiling QMK?" - echo "If you don't want that, you can install the dependencies manually." - read -p "(Y/N) " res - case $res in - [Yy]* ) ./linux_install.sh; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac -done - -download_dir=wsl_downloaded - -source "$dir/win_shared_install.sh" - -pip3 install -r ${util_dir}/../requirements.txt - -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 enter 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 your" - echo ".bashrc file? Without this make won't find the needed utils, so if you don't" - echo "want to do it automatically, then you have to do it manually later." - 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 - -while true; do - echo - echo "Do you want to add a symlink to the QMK repository in your home directory for" - echo "convenience? 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" - echo "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!" -echo "You need to open a new bash command prompt for all the utils to work properly" -echo "******************************************************************************" - -popd > /dev/null