diff options
author | Ryan <[email protected]> | 2020-11-27 01:37:54 +1100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-26 14:37:54 +0000 |
commit | c21d5a09735e84412ee5b3efb4c3f5d3fc734393 (patch) | |
tree | c2b8405f45fb6f00b063561056fca4c5aad28bf8 /util/qmk_install.sh | |
parent | 3afe0ea9b9f67ae33f54c1393b15d988764241a2 (diff) | |
download | qmk_firmware-c21d5a09735e84412ee5b3efb4c3f5d3fc734393.tar.gz qmk_firmware-c21d5a09735e84412ee5b3efb4c3f5d3fc734393.zip |
Refactor qmk_install.sh (#10681)0.10.54
Diffstat (limited to 'util/qmk_install.sh')
-rwxr-xr-x | util/qmk_install.sh | 93 |
1 files changed, 70 insertions, 23 deletions
diff --git a/util/qmk_install.sh b/util/qmk_install.sh index 714ee91445..5076e980a2 100755 --- a/util/qmk_install.sh +++ b/util/qmk_install.sh @@ -1,27 +1,74 @@ -#!/bin/sh -# Pick the correct install script based on the current OS +#!/bin/bash -util_dir=$(dirname "$0") +QMK_FIRMWARE_DIR=$(cd -P -- "$(dirname -- "$0")/.." && pwd -P) +QMK_FIRMWARE_UTIL_DIR=$QMK_FIRMWARE_DIR/util case $(uname -a) in - *Darwin*) - exec "${util_dir}/macos_install.sh" - ;; - *FreeBSD*) - exec "${util_dir}/freebsd_install.sh" - ;; - *Linux*) - exec "${util_dir}/linux_install.sh" - ;; - 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 - ;; + *Darwin*) + . "$QMK_FIRMWARE_UTIL_DIR/install/macos.sh";; + *FreeBSD*) + . "$QMK_FIRMWARE_UTIL_DIR/install/freebsd.sh";; + *MINGW64_NT*) + . "$QMK_FIRMWARE_UTIL_DIR/install/msys2.sh";; + *MSYS_NT*|*MINGW32_NT*) + echo "Please open a MinGW64 terminal window and re-run this script." + exit 1;; + *Linux*) + . "$QMK_FIRMWARE_UTIL_DIR/install/linux_shared.sh" + + case $(grep ID /etc/os-release) in + *arch*|*manjaro*) + . "$QMK_FIRMWARE_UTIL_DIR/install/arch.sh";; + *debian*|*ubuntu*) + . "$QMK_FIRMWARE_UTIL_DIR/install/debian.sh";; + *fedora*) + . "$QMK_FIRMWARE_UTIL_DIR/install/fedora.sh";; + *gentoo*) + . "$QMK_FIRMWARE_UTIL_DIR/install/gentoo.sh";; + *opensuse*|*tumbleweed*) + . "$QMK_FIRMWARE_UTIL_DIR/install/opensuse.sh";; + *sabayon*) + . "$QMK_FIRMWARE_UTIL_DIR/install/sabayon.sh";; + *slackware*) + . "$QMK_FIRMWARE_UTIL_DIR/install/slackware.sh";; + *solus*) + . "$QMK_FIRMWARE_UTIL_DIR/install/solus.sh";; + *void*) + . "$QMK_FIRMWARE_UTIL_DIR/install/void.sh";; + *) + echo "Sorry, we don't recognize your distribution. Help us by contributing support!" + echo + echo "https://docs.qmk.fm/#/contributing" + exit 1;; + esac + + 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$\\<distro> *" + echo "********************************************************************************" + echo + fi + ;; + *) + echo "Sorry, we don't recognize your environment. Help us by contributing support!" + echo + echo "https://docs.qmk.fm/#/contributing" + exit 1;; esac + +if type _qmk_install_prepare &>/dev/null; then + _qmk_install_prepare || exit 1 +fi + +_qmk_install + +if type _qmk_install_bootloadhid &>/dev/null; then + _qmk_install_bootloadhid +fi |