20 lines
601 B
Bash
20 lines
601 B
Bash
#!/bin/bash
|
|
|
|
#sync libs'
|
|
|
|
if [ -f "$(which jq)" ]; then
|
|
HEADER=ino/lib/McopySerial/McopySerial.h
|
|
TMP_FILE=$(mktemp)
|
|
|
|
awk '{print} /CMD FLAGS/ {exit}' "${HEADER}" > "${TMP_FILE}"
|
|
|
|
cat ./data/cfg.json | jq -r '.arduino.cmd | keys[] as $k | " static const char \($k) = '"'"'\(.[$k])'"'"';"' | awk '{print "\t"$1" "$2" "$3" "toupper($4)" "$5" "$6}' >> "${TMP_FILE}"
|
|
|
|
awk '/END CMD/,EOF { print $0 }' "${HEADER}" >> "${TMP_FILE}"
|
|
|
|
cp "${TMP_FILE}" "${HEADER}"
|
|
rm -f "${TMP_FILE}"
|
|
fi
|
|
|
|
cp ino/lib/McopySerial/McopySerial.* ino/mcopy_cam_canon/
|
|
cp ino/lib/McopySerial/McopySerial.* ino/mcopy_JKMM100/ |