From 05fc6e2d77ca5e2ee30805852f88904ee8fd4d2b Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 8 Dec 2020 17:29:12 +0800 Subject: [PATCH] [feature] qmk dev-env --- devel/qmk.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 devel/qmk.sh diff --git a/devel/qmk.sh b/devel/qmk.sh new file mode 100755 index 0000000..5b8ff06 --- /dev/null +++ b/devel/qmk.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +DIR=$(dirname "$(readlink -f "$0")") +. "$DIR/../env.sh" + +log "Setting up qmk" + +if [ -z "$QMK_HOME" ]; then + echo "warning: \$QMK_HOME is empty!\ + if you already had qmk_firmware cloned, set it to \$QMK_HOME first \ + press Ctrl-c to cancel the installation, Enter to continue" + read -r +fi + +if in_china && [ -z "$HTTPS_PROXY" ]; then + echo "warning: \$HTTPS_PROXY is empty!\ + cloning speed for submodules could be slow AF in china, are u sure? \ + press Ctrl-c to cancel the installation, Enter to continue" + read -r +fi + +QMK_HOME=${QMK_HOME-"$HOME/qmk_firmware"} + +case "$PM" in + apt) + sudo pip3 install qmk + # for ps2_mouse + sudo apt install avr-libc + ;; + pacman) + sudo pip install qmk + ;; +esac + +# setup udev rule for flashing +sudo cp "$QMK_HOME/util/udev/50-qmk.rules" /etc/udev/rules.d/ + +# check if qmk setup is needed, not very elegant though. +if [ ! -d "$QMK_HOME/lib/chibios/.git" ]; then + qmk setup +fi