forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoqmk.bash
executable file
·69 lines (59 loc) · 1.48 KB
/
doqmk.bash
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /bin/bash
display_help() {
echo "
Available options:
--no-flash - If you want to open the list of pull requests
-n
--help - This message
-h
"
}
flash='true'
for opt in "$@"; do
case ${opt} in
--no-flash)
flash='false'
;;
*)
display_help
exit 1
;;
esac
done
self="${BASH_SOURCE[0]}"
while [ -L "${self}" ]; do
self_dir="$(cd -P "$(dirname "${self}")" >/dev/null 2>&1 && pwd)"
self="$(readlink "${self}")"
[[ ${self} != /* ]] && self="${self_dir}/${self}"
done
self="$(readlink -f "${self}")"
qmk_root=$(dirname "${self}")
[ -z "${qmk_root}" ] && echo 'do where now?' && exit
cd "${qmk_root}" || exit
keymap="${qmk_root}/keyboards/keebio/quefrency/keymaps/efjacobson/keymap.c"
sed -i.bu 's/_______/KC_TRNS/g' "${keymap}"
if [ -e "${qmk_root}/.secret" ]; then
secret="$(cat "${qmk_root}/.secret")"
else
printf 'enter secret: '
if ! read -rs secret; then
echo 'fail:read:secret'
exit 1
fi
printf '\n'
read -r -p 'save secret to file? [y/N] ' save
if [[ "${save}" =~ ^[Yy](es)?$ ]]; then
echo "${secret}" >"${qmk_root}/.secret"
fi
fi
if [ "$(uname)" == 'Darwin' ]; then
sed -i '' "s/SUPER_SRSLY_SECRET_YALL/${secret}/g" "${keymap}"
else
sed -i "s/SUPER_SRSLY_SECRET_YALL/${secret}/g" "${keymap}"
fi
if [ "${flash}" == 'true' ]; then
qmk flash -kb keebio/quefrency/rev2 -km efjacobson
else
qmk compile -kb keebio/quefrency/rev2 -km efjacobson
fi
mv "${keymap}.bu" "${keymap}"