-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·42 lines (33 loc) · 884 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Usage: ./dev.sh [once]
# Description: Make the PCB file from the keyboard.yaml file.
# Whenever the keyboard.yaml file is modified, the PCB file is regenerated.
# If the "once" argument is passed, the PCB file is only generated once and
# the script exits.
set -e
# Check arguments
if [[ "$1" != "once" && "$1" != "" ]]; then
echo "Usage: ./dev.sh [once]"
exit 1
fi
OUTPUT_DIR=output
pcbnew_pid=
build() {
node_modules/ergogen/src/cli.js . -o $OUTPUT_DIR && \
{
if [[ "$pcbnew_pid" ]]; then
kill "$pcbnew_pid" || true
rm -rf $OUTPUT_DIR/pcbs/\~main.kicad_pcb.lck
fi
pcbnew $OUTPUT_DIR/pcbs/main.kicad_pcb &
pcbnew_pid=$!
} || true
}
build
if [[ "$1" == "once" ]]; then
exit 0
fi
while true; do
inotifywait -e modify config.yaml footprints/ || true
build
done