blob: 51ecb7ac2d7105b85dec36f18a6eb38404f74d52 (
plain) (
blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#!/usr/bin/env sh
set -e
# Moonlander Layout
#
# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This file is part of Moonlander Layout.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/agpl.txt>.
LAYOUT_ID="KWBYA"
LAYOUT_GEOMETRY="moonlander"
# # Download layout source
# data="$(mktemp)"
# echo
# cat <<EOF >"$data"
# { "query": "query getLayout(\$hashId: String!, \$revisionId: String!, \$geometry: String) {layout(hashId: \$hashId, geometry: \$geometry, revisionId: \$revisionId) { revision { hashId, qmkVersion, title }}}","variables":{"hashId":"$LAYOUT_ID","geometry":"$LAYOUT_GEOMETRY","revisionId":"latest"}}
# EOF
#
# response="$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data "$(cat "$data")" | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]')"
#
# hash_id="$(echo "${response}" | jq -r '.[0]')"
# firmware_version=$(printf "%.0f" "$(echo "${response}" | jq -r '.[1]')")
# change_description=$(echo "${response}" | jq -r '.[2]')
# if [ -z "${change_description}" ]; then
# change_description="latest layout modification made with Oryx"
# fi
#
# curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip
#
# # Unzip the source file
# unzip -oj source.zip '*_source/*' -d "$LAYOUT_ID"
# rm source.zip
#
# # Commit and Push changes
# git config --local user.name "github-actions"
# git config --local user.email "github-actions@github.com"
# git add .
# git commit -m "✨(oryx): $change_description" || echo "No layout change"
# git push
#
# # Merge Oryx with custom QMK
# git fetch origin main
# git checkout -B main origin/main
# git merge -Xignore-all-space oryx
# git push
#
# # Checkout the right firmware branch
# cd qmk_firmware
# git submodule update --init --remote
# git fetch origin "firmware$firmware_version"
# git checkout -B "firmware$firmware_version" "origin/firmware$firmware_version"
# git submodule update --init --recursive
#
# # Build qmk docker image
# docker build -t qmk .
# # Build the layout
# ## Set keyboard directory and make prefix based on firmware version
# if [ "$firmware_version" -ge 24 ]; then
# keyboard_directory="qmk_firmware/keyboards/zsa"
# make_prefix="zsa/"
# else
# keyboard_directory="qmk_firmware/keyboards"
# make_prefix=""
# fi
#
# ## Copy layout files to the qmk folder
# rm -rf ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps/$LAYOUT_ID
# mkdir -p ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps && cp -r $LAYOUT_ID ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps
## Build the layout
docker run -v ./qmk_firmware:/root --rm qmk /bin/sh -c "
qmk setup zsa/qmk_firmware -b 'firmware$firmware_version' -y
make ${make_prefix}$LAYOUT_GEOMETRY:$LAYOUT_ID
"
## Find and export built layout
normalized_layout_geometry="$(echo "$LAYOUT_GEOMETRY" | sed 's/\//_/g')"
built_layout_file="$(find ./qmk_firmware -maxdepth 1 -type f -regex ".*${normalized_layout_geometry}.*\.\(bin\|hex\)$")"
|