#!/bin/bash set -e # Build script for QMK firmware using Docker # Usage: ./build.sh [keyboard] [user] KEYBOARD=${1:-all} USER=${2:-dgvigil} echo "Building QMK firmware for user: $USER" # Build the Docker image if it doesn't exist if [[ "$(docker images -q qmk-builder 2> /dev/null)" == "" ]]; then echo "Building Docker image..." docker build --load -t qmk-builder . fi # Function to build a specific keyboard build_keyboard() { local kb=$1 local user=$2 echo "Building $kb for user $user..." # Map keyboard names to QMK paths case $kb in "draculad") qmk_path="draculad" ;; "iris") qmk_path="keebio/iris/rev8" ;; "scottogame") qmk_path="handwired/scottokeebs/scottogame" ;; "sweep") qmk_path="ferris/sweep" ;; "swoop") qmk_path="bluebell/swoop" ;; *) echo "Unknown keyboard: $kb" exit 1 ;; esac # Run the build in Docker docker run --rm \ -v "$(pwd):/workspace" \ -w /workspace \ -e USER=$user \ qmk-builder \ bash -c " cd $QMK_HOME qmk compile -kb $qmk_path -km $user " } # Build all keyboards or specific one if [ "$KEYBOARD" = "all" ]; then echo "Building all keyboards..." for kb in draculad iris scottogame sweep swoop; do build_keyboard $kb $USER done else build_keyboard $KEYBOARD $USER fi echo "Build complete!" echo "Firmware files should be in the qmk_firmware directory"