2 # NOTE: This script uses tabs for indentation
8 USAGE="Usage: $0 [keyboard[:keymap[:target]]]"
12 if [ "$arg" = "--help" ]; then
20 elif ! command -v docker >/dev/null 2>&1; then
21 errcho "Error: docker not found"
22 errcho "See https://docs.docker.com/install/#supported-platforms for installation instructions"
28 printf "keyboard=" && read -r keyboard
29 [ -n "$keyboard" ] && printf "keymap=" && read -r keymap
30 [ -n "$keymap" ] && printf "target=" && read -r target
32 IFS=':' read -r keyboard keymap target x <<-EOF
40 if [ -n "$target" ]; then
41 if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then
42 usb_args="--privileged -v /dev:/dev"
44 errcho "Error: target requires docker-machine to work on your platform"
45 errcho "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos"
46 errcho "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead"
50 dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows
52 # Run container and build firmware
53 docker run --rm -it $usb_args \
54 --user $(id -u):$(id -g) \
56 -v "$dir":/qmk_firmware \
57 -e ALT_GET_KEYBOARDS=true \
58 -e SKIP_GIT="$SKIP_GIT" \
59 -e MAKEFLAGS="$MAKEFLAGS" \
60 qmkfm/base_container \
61 make "$keyboard${keymap:+:$keymap}${target:+:$target}"