From c21d5a09735e84412ee5b3efb4c3f5d3fc734393 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 27 Nov 2020 01:37:54 +1100 Subject: Refactor qmk_install.sh (#10681) --- util/install/arch.sh | 16 ++++++++++++++++ util/install/debian.sh | 22 ++++++++++++++++++++++ util/install/fedora.sh | 15 +++++++++++++++ util/install/freebsd.sh | 18 ++++++++++++++++++ util/install/gentoo.sh | 33 +++++++++++++++++++++++++++++++++ util/install/linux_shared.sh | 13 +++++++++++++ util/install/macos.sh | 26 ++++++++++++++++++++++++++ util/install/msys2.sh | 36 ++++++++++++++++++++++++++++++++++++ util/install/opensuse.sh | 31 +++++++++++++++++++++++++++++++ util/install/sabayon.sh | 15 +++++++++++++++ util/install/slackware.sh | 25 +++++++++++++++++++++++++ util/install/solus.sh | 19 +++++++++++++++++++ util/install/void.sh | 15 +++++++++++++++ 13 files changed, 284 insertions(+) create mode 100755 util/install/arch.sh create mode 100755 util/install/debian.sh create mode 100755 util/install/fedora.sh create mode 100755 util/install/freebsd.sh create mode 100755 util/install/gentoo.sh create mode 100755 util/install/linux_shared.sh create mode 100755 util/install/macos.sh create mode 100755 util/install/msys2.sh create mode 100755 util/install/opensuse.sh create mode 100755 util/install/sabayon.sh create mode 100755 util/install/slackware.sh create mode 100755 util/install/solus.sh create mode 100755 util/install/void.sh (limited to 'util/install') diff --git a/util/install/arch.sh b/util/install/arch.sh new file mode 100755 index 0000000000..7442e2f136 --- /dev/null +++ b/util/install/arch.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +_qmk_install() { + echo "Installing dependencies" + + sudo pacman --needed --noconfirm -S \ + base-devel clang diffutils gcc git unzip wget zip \ + python-pip \ + avr-binutils \ + arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib \ + avrdude dfu-programmer dfu-util + sudo pacman --needed --noconfirm -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz + sudo pacman --needed --noconfirm -S avr-libc # Must be installed after the above, or it will bring in the latest avr-gcc instead + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/debian.sh b/util/install/debian.sh new file mode 100755 index 0000000000..e7180c6512 --- /dev/null +++ b/util/install/debian.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +DEBIAN_FRONTEND=noninteractive +DEBCONF_NONINTERACTIVE_SEEN=true +export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN + +_qmk_install_prepare() { + sudo apt-get update +} + +_qmk_install() { + echo "Installing dependencies" + + sudo apt-get -yq install \ + build-essential clang-format diffutils gcc git unzip wget zip \ + python3-pip \ + binutils-avr gcc-avr avr-libc \ + binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi \ + avrdude dfu-programmer dfu-util teensy-loader-cli + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/fedora.sh b/util/install/fedora.sh new file mode 100755 index 0000000000..250cda6624 --- /dev/null +++ b/util/install/fedora.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +_qmk_install() { + echo "Installing dependencies" + + # TODO: Check whether devel/headers packages are really needed + sudo dnf -y install \ + clang diffutils git gcc glibc-headers kernel-devel kernel-headers make unzip wget zip \ + python3 \ + avr-binutils avr-gcc avr-libc \ + arm-none-eabi-binutils-cs arm-none-eabi-gcc-cs arm-none-eabi-newlib \ + avrdude dfu-programmer dfu-util + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/freebsd.sh b/util/install/freebsd.sh new file mode 100755 index 0000000000..353c52d647 --- /dev/null +++ b/util/install/freebsd.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +_qmk_install_prepare() { + sudo pkg update +} + +_qmk_install() { + echo "Installing dependencies" + + sudo pkg install -y \ + git wget gmake gcc zip unzip diffutils \ + python3 \ + avr-binutils avr-gcc avr-libc \ + arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib \ + avrdude dfu-programmer dfu-util + + sudo python3 -m pip install -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/gentoo.sh b/util/install/gentoo.sh new file mode 100755 index 0000000000..d4284e9a93 --- /dev/null +++ b/util/install/gentoo.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +_qmk_install_prepare() { + echo "This script will make a USE change in order to ensure that that QMK works on your system." + echo "All changes will be sent to the file /etc/portage/package.use/qmkfirmware -- please review it, and read Portage's output carefully before installing any packages on your system." + echo "You will also need to ensure that your kernel is compiled with support for the microcontroller that you are using (e.g. enable Arduino for the Pro Micro). Further information can be found on the Gentoo wiki." + + read -p "Proceed? [y/N] " res + case $res in + [Yy]*) + return 0;; + *) + return 1;; + esac +} + +_qmk_install() { + echo "Installing dependencies" + + sudo touch /etc/portage/package.use/qmkfirmware + # tee is used here since sudo doesn't apply to >> + echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null + sudo emerge -auN sys-devel/gcc + sudo emerge -au --noreplace \ + app-arch/unzip app-arch/zip net-misc/wget sys-devel/clang sys-devel/crossdev \ + \>=dev-lang/python-3.6 \ + dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util + + sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr + sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/linux_shared.sh b/util/install/linux_shared.sh new file mode 100755 index 0000000000..cb81e8611f --- /dev/null +++ b/util/install/linux_shared.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# For those distros that do not package bootloadHID +_qmk_install_bootloadhid() { + if ! command -v bootloadHID > /dev/null; then + wget https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz -O - | tar -xz -C /tmp + pushd /tmp/bootloadHID.2012-12-08/commandline/ > /dev/null + if make; then + sudo cp bootloadHID /usr/local/bin + fi + popd > /dev/null + fi +} diff --git a/util/install/macos.sh b/util/install/macos.sh new file mode 100755 index 0000000000..93fda91215 --- /dev/null +++ b/util/install/macos.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +_qmk_install_prepare() { + echo "Checking Homebrew installation" + + if ! brew --version >/dev/null 2>&1; then + echo "Error! Homebrew is broken or not installed." + echo "Please run \`brew doctor\` or follow the installation instructions at https://brew.sh/, then re-run this script." + return 1 + fi + + brew update && brew upgrade +} + +_qmk_install() { + echo "Installing dependencies" + + # All macOS dependencies are managed in the Homebrew package: + # https://github.com/qmk/homebrew-qmk + brew install qmk/qmk/qmk + + brew link --force avr-gcc@8 + brew link --force arm-gcc-bin@8 + + python3 -m pip install -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/msys2.sh b/util/install/msys2.sh new file mode 100755 index 0000000000..c8598a60fa --- /dev/null +++ b/util/install/msys2.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +_qmk_install_prepare() { + pacman -Syu +} + +_qmk_install() { + echo "Installing dependencies" + + pacman --needed --noconfirm --disable-download-timeout -S pactoys-git + pacboy sync --needed --noconfirm --disable-download-timeout \ + base-devel: toolchain:x clang:x git: unzip: \ + python3-pip:x \ + avr-binutils:x avr-gcc:x avr-libc:x \ + arm-none-eabi-binutils:x arm-none-eabi-gcc:x arm-none-eabi-newlib:x \ + avrdude:x bootloadhid:x dfu-programmer:x dfu-util:x teensy-loader-cli:x + + _qmk_install_drivers + + python3 -m pip install -r "$QMK_FIRMWARE_DIR/requirements.txt" +} + +_qmk_install_drivers() { + echo "Installing drivers" + + tmpdir=$(mktemp -d) + cp "$QMK_FIRMWARE_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 +} diff --git a/util/install/opensuse.sh b/util/install/opensuse.sh new file mode 100755 index 0000000000..47b44ae364 --- /dev/null +++ b/util/install/opensuse.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +_qmk_install_prepare() { + case $(grep ID /etc/os-release) in + *15.1*) + REPO_RELEASE=Leap_15.1;; + *15.2*) + REPO_RELEASE=Leap_15.2;; + *) + #REPO_RELEASE=Tumbleweed;; + echo "ERROR: Tumbleweed is currently not supported." + exit 1 + esac + + sudo zypper addrepo https://download.opensuse.org/repositories/devel:gcc/openSUSE_$REPO_RELEASE/devel:gcc.repo + sudo zypper addrepo https://download.opensuse.org/repositories/hardware/openSUSE_$REPO_RELEASE/hardware.repo + sudo zypper --gpg-auto-import-keys refresh +} + +_qmk_install() { + echo "Installing dependencies" + + sudo zypper install -y \ + make clang gcc unzip wget zip \ + python3-pip \ + cross-avr-binutils cross-avr-gcc8 avr-libc \ + cross-arm-binutils cross-arm-none-gcc8 cross-arm-none-newlib-devel \ + avrdude dfu-programmer dfu-util + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/sabayon.sh b/util/install/sabayon.sh new file mode 100755 index 0000000000..fd4f4d8dfd --- /dev/null +++ b/util/install/sabayon.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +_qmk_install() { + echo "Installing dependencies" + + sudo equo install \ + app-arch/unzip app-arch/zip net-misc/wget dev-vcs/git sys-devel/clang sys-devel/gcc sys-devel/crossdev \ + dev-python/pip \ + dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util + + sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr + sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/slackware.sh b/util/install/slackware.sh new file mode 100755 index 0000000000..d73303159d --- /dev/null +++ b/util/install/slackware.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +_qmk_install_prepare() { + echo "Before you continue, please ensure that your user is added to sudoers and that sboinstall is configured." + read -p "Proceed? [y/N] " res + + case $res in + [Yy]*) + ;; + *) + return 1;; + esac +} + +_qmk_install() { + echo "Installing dependencies" + + sudo sboinstall \ + avr-binutils avr-gcc avr-libc \ + arm-binutils arm-gcc newlib \ + python3 \ + avrdude dfu-programmer dfu-util teensy_loader_cli + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/solus.sh b/util/install/solus.sh new file mode 100755 index 0000000000..5633f7039c --- /dev/null +++ b/util/install/solus.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +_qmk_install_prepare() { + sudo eopkg -y update-repo + sudo eopkg -y upgrade +} + +_qmk_install() { + echo "Installing dependencies" + + sudo eopkg -y install \ + -c system.devel git wget zip unzip \ + python3 \ + avr-binutils avr-gcc avr-libc \ + arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib \ + avrdude dfu-programmer dfu-util + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} diff --git a/util/install/void.sh b/util/install/void.sh new file mode 100755 index 0000000000..9ec7019e5c --- /dev/null +++ b/util/install/void.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +_qmk_install() { + echo "Installing dependencies" + + sudo xbps-install \ + gcc git make wget unzip zip \ + python3-pip \ + avr-binutils avr-gcc avr-libc \ + cross-arm-none-eabi-binutils cross-arm-none-eabi-gcc cross-arm-none-eabi-newlib \ + avrdude dfu-programmer dfu-util teensy_loader_cli \ + libusb-compat-devel + + python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt +} -- cgit v1.2.3 From 992380a5ddc87546f124238b53122c23ade6b421 Mon Sep 17 00:00:00 2001 From: Jonathan Paugh Date: Tue, 29 Dec 2020 20:21:00 -0600 Subject: Add missing Debian/Ubuntu dependency to the install script (#11348) To successfully compile bootloadHID, we must have the libusb-config tool, which comes from the libusb-dev package. This package is available in both Ubuntu Groovy and Debian Buster Co-authored-by: Jonathan Paugh --- util/install/debian.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/install') diff --git a/util/install/debian.sh b/util/install/debian.sh index e7180c6512..0ae9764a33 100755 --- a/util/install/debian.sh +++ b/util/install/debian.sh @@ -16,7 +16,7 @@ _qmk_install() { python3-pip \ binutils-avr gcc-avr avr-libc \ binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi \ - avrdude dfu-programmer dfu-util teensy-loader-cli + avrdude dfu-programmer dfu-util teensy-loader-cli libusb-dev python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt } -- cgit v1.2.3 From 0f5f6a6a75b26d06ae5ee2b726eb97a67d04d325 Mon Sep 17 00:00:00 2001 From: Maurizio Porrato Date: Wed, 30 Dec 2020 04:12:02 +0000 Subject: Add libusb-devel dependency for fedora (#11287) On fedora 33, libusb-devel is required to build BootloadHID --- util/install/fedora.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/install') diff --git a/util/install/fedora.sh b/util/install/fedora.sh index 250cda6624..44b71b98bf 100755 --- a/util/install/fedora.sh +++ b/util/install/fedora.sh @@ -9,7 +9,7 @@ _qmk_install() { python3 \ avr-binutils avr-gcc avr-libc \ arm-none-eabi-binutils-cs arm-none-eabi-gcc-cs arm-none-eabi-newlib \ - avrdude dfu-programmer dfu-util + avrdude dfu-programmer dfu-util libusb-devel python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt } -- cgit v1.2.3 From acec174fde729982c273b326ef7dc75a1f1949e8 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 4 Jan 2021 07:30:59 +1100 Subject: Homebrew install: ignore pinned formulae in `brew upgrade` (#11423) --- util/install/macos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/install') diff --git a/util/install/macos.sh b/util/install/macos.sh index 93fda91215..4b87217ba0 100755 --- a/util/install/macos.sh +++ b/util/install/macos.sh @@ -9,7 +9,7 @@ _qmk_install_prepare() { return 1 fi - brew update && brew upgrade + brew update && brew upgrade --ignore-pinned } _qmk_install() { -- cgit v1.2.3 From cd336b2b545798269405e8ffef0fe8958d4d27d4 Mon Sep 17 00:00:00 2001 From: Zach White Date: Sat, 13 Feb 2021 10:26:45 -0800 Subject: bump to python 3.7 (#11408) --- util/install/gentoo.sh | 2 +- util/install/opensuse.sh | 31 ------------------------------- util/install/sabayon.sh | 15 --------------- 3 files changed, 1 insertion(+), 47 deletions(-) delete mode 100755 util/install/opensuse.sh delete mode 100755 util/install/sabayon.sh (limited to 'util/install') diff --git a/util/install/gentoo.sh b/util/install/gentoo.sh index d4284e9a93..97eb5df07f 100755 --- a/util/install/gentoo.sh +++ b/util/install/gentoo.sh @@ -23,7 +23,7 @@ _qmk_install() { sudo emerge -auN sys-devel/gcc sudo emerge -au --noreplace \ app-arch/unzip app-arch/zip net-misc/wget sys-devel/clang sys-devel/crossdev \ - \>=dev-lang/python-3.6 \ + \>=dev-lang/python-3.7 \ dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr diff --git a/util/install/opensuse.sh b/util/install/opensuse.sh deleted file mode 100755 index 47b44ae364..0000000000 --- a/util/install/opensuse.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -_qmk_install_prepare() { - case $(grep ID /etc/os-release) in - *15.1*) - REPO_RELEASE=Leap_15.1;; - *15.2*) - REPO_RELEASE=Leap_15.2;; - *) - #REPO_RELEASE=Tumbleweed;; - echo "ERROR: Tumbleweed is currently not supported." - exit 1 - esac - - sudo zypper addrepo https://download.opensuse.org/repositories/devel:gcc/openSUSE_$REPO_RELEASE/devel:gcc.repo - sudo zypper addrepo https://download.opensuse.org/repositories/hardware/openSUSE_$REPO_RELEASE/hardware.repo - sudo zypper --gpg-auto-import-keys refresh -} - -_qmk_install() { - echo "Installing dependencies" - - sudo zypper install -y \ - make clang gcc unzip wget zip \ - python3-pip \ - cross-avr-binutils cross-avr-gcc8 avr-libc \ - cross-arm-binutils cross-arm-none-gcc8 cross-arm-none-newlib-devel \ - avrdude dfu-programmer dfu-util - - python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt -} diff --git a/util/install/sabayon.sh b/util/install/sabayon.sh deleted file mode 100755 index fd4f4d8dfd..0000000000 --- a/util/install/sabayon.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -_qmk_install() { - echo "Installing dependencies" - - sudo equo install \ - app-arch/unzip app-arch/zip net-misc/wget dev-vcs/git sys-devel/clang sys-devel/gcc sys-devel/crossdev \ - dev-python/pip \ - dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util - - sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr - sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi - - python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt -} -- cgit v1.2.3 From db1eacdaacb9c8f6889f46bc1c6af155b81ad72a Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 19 May 2021 15:24:46 -0700 Subject: Align our subprocess usage with current best practices. (#12940) * Align our subprocess usage with current best practices. * remove unused import * Apply suggestions from code review Co-authored-by: Ryan * fix the cpp invocation for older python * allow for unprompted installation * make sure qmk new-keyboard works on windows Co-authored-by: Ryan --- util/install/debian.sh | 2 +- util/install/fedora.sh | 2 +- util/install/freebsd.sh | 2 +- util/install/msys2.sh | 2 +- util/install/void.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'util/install') diff --git a/util/install/debian.sh b/util/install/debian.sh index 0ae9764a33..885df723d9 100755 --- a/util/install/debian.sh +++ b/util/install/debian.sh @@ -5,7 +5,7 @@ DEBCONF_NONINTERACTIVE_SEEN=true export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN _qmk_install_prepare() { - sudo apt-get update + sudo apt-get update $SKIP_PROMPT } _qmk_install() { diff --git a/util/install/fedora.sh b/util/install/fedora.sh index 44b71b98bf..d9452f68d5 100755 --- a/util/install/fedora.sh +++ b/util/install/fedora.sh @@ -4,7 +4,7 @@ _qmk_install() { echo "Installing dependencies" # TODO: Check whether devel/headers packages are really needed - sudo dnf -y install \ + sudo dnf $SKIP_PROMPT install \ clang diffutils git gcc glibc-headers kernel-devel kernel-headers make unzip wget zip \ python3 \ avr-binutils avr-gcc avr-libc \ diff --git a/util/install/freebsd.sh b/util/install/freebsd.sh index 353c52d647..d9399a5de9 100755 --- a/util/install/freebsd.sh +++ b/util/install/freebsd.sh @@ -1,7 +1,7 @@ #!/bin/bash _qmk_install_prepare() { - sudo pkg update + sudo pkg update $SKIP_PROMPT } _qmk_install() { diff --git a/util/install/msys2.sh b/util/install/msys2.sh index c8598a60fa..b1300a34d2 100755 --- a/util/install/msys2.sh +++ b/util/install/msys2.sh @@ -1,7 +1,7 @@ #!/bin/bash _qmk_install_prepare() { - pacman -Syu + pacman -Syu $MSYS2_CONFIRM } _qmk_install() { diff --git a/util/install/void.sh b/util/install/void.sh index 9ec7019e5c..c49c3ef63f 100755 --- a/util/install/void.sh +++ b/util/install/void.sh @@ -3,7 +3,7 @@ _qmk_install() { echo "Installing dependencies" - sudo xbps-install \ + sudo xbps-install $SKIP_PROMPT \ gcc git make wget unzip zip \ python3-pip \ avr-binutils avr-gcc avr-libc \ -- cgit v1.2.3