#!/usr/bin/env bash # Prepares the firmware source tree: vial-qmk + the Silakka54 LED keymap (v1.4led) + the KeyOverlay HID command. # Usage: bash firmware/prepare-source.sh [work-dir] (default work-dir: .firmware-work next to this repo) # Safe to run again: sources are only cloned once, copied files are refreshed. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" WORK="${1:-$HERE/../.firmware-work}" QMK="$WORK/vial-qmk" SRC="$WORK/silakka54-src" DEST="$QMK/keyboards/silakka54led" mkdir -p "$WORK" if [ ! -d "$QMK" ]; then git clone --depth 1 --branch vial https://github.com/vial-kb/vial-qmk.git "$QMK" git -C "$QMK" submodule update --init --depth 1 --recursive fi if [ ! -d "$SRC" ]; then git clone --depth 1 --branch v1.4led https://github.com/Squalius-cephalus/silakka54.git "$SRC" fi # The LED keymap lives in the silakka54 repo, not in vial-qmk: copy it in as its own keyboard folder. mkdir -p "$DEST" cp -r "$SRC/firmware/." "$DEST/" cp "$HERE/keyoverlay_hid.c" "$DEST/keymaps/vial_led/" RULES="$DEST/keymaps/vial_led/rules.mk" grep -q "keyoverlay_hid.c" "$RULES" || printf '\nSRC += keyoverlay_hid.c\n' >> "$RULES" echo "Firmware source ready in: $QMK" echo "Next: docker build -t keyoverlay-fw-build firmware, then run firmware/build-in-container.sh (see firmware/README.md)"