From ccb9b9309a37f55e0aca3c79aa1d78214a42f701 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 10:02:44 -0400 Subject: Script fixes, ability to prepopulate a keymap. * Use read w/ -i for initial default values. * Prompt for fetching keymap for customization, and grab latest from `main` if opted in. * Don't copy `prj.conf` from the template, pull the `.conf` from `main` also. --- docs/static/setup.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'docs/static') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 23ab42b..a122994 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -7,6 +7,7 @@ title="ZMK Config Setup:" # TODO: Check for git being installed +# TODO: Check for curl being installed # TODO: Check for user.name and user.email git configs being set prompt="Pick an MCU board:" @@ -41,7 +42,7 @@ options=("Kyria" "Lily58") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. # select opt in "${options[@]}" "Other" "Quit"; do -select opt in "${options[@]}" "Other" "Quit"; do +select opt in "${options[@]}" "Quit"; do case "$REPLY" in @@ -56,12 +57,16 @@ select opt in "${options[@]}" "Other" "Quit"; do esac done -read -p "GitHub Username (leave empty to skip GitHub repo creation): " github_user +read -e -p "Copy in the stock keymap for customization? [Yn]: " copy_keymap + +if [ -z "$copy_keymap" ] || [ "$copy_keymap" == "Y" ] || [ "$copy_keymap" == "y" ]; then copy_keymap="yes"; fi + +read -e -p "GitHub Username (leave empty to skip GitHub repo creation): " github_user if [ -n "$github_user" ]; then - read -p "GitHub Repo Name [zmk-config]: " repo_name + read -e -i "zmk-config" -p "GitHub Repo Name: " repo_name if [ -z "$repo_name" ]; then repo_name="zmk-config"; fi - read -p "GitHub Repo [https://github.com/${github_user}/${repo_name}.git]: " github_repo + read -e -i "https://github.com/${github_user}/${repo_name}.git" -p "GitHub Repo: " github_repo if [ -z "$github_repo" ]; then github_repo="https://github.com/${github_user}/${repo_name}.git"; fi else @@ -72,6 +77,11 @@ echo "" echo "Preparing a user config for:" echo "* MCU Board: ${board}" echo "* Shield: ${shield}" +if [ "$copy_keymap" == "yes" ]; then + echo "* Copy Keymap?: ✓" +else + echo "* Copy Keymap?: ❌" +fi if [ -n "$github_repo" ]; then echo "* GitHub Repo To Push (please create this in GH first!): ${github_repo}" fi @@ -87,14 +97,22 @@ fi git clone --single-branch $repo_path ${repo_name} cd ${repo_name} +pushd config + +curl -O "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.conf" + +if [ "$copy_keymap" == "yes" ]; then + curl -O "https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${shield}/${shield}.keymap" +fi + +popd + sed -i \ -e "s/BOARD_NAME/$board/" \ -e "s/SHIELD_NAME/$shield/" \ -e "s/KEYBOARD_TITLE/$shield_title/" \ .github/workflows/build.yml -mv config/prj.conf "config/${shield}.conf" - rm -rf .git git init . git add . -- cgit v1.2.3 From 5039a508311bcd74c1aaef7542c3b6e1c6a01929 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 7 Aug 2020 23:35:48 -0400 Subject: Tweak git usage for backwards compatibility. * Closes #76 --- docs/static/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/static') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index a122994..1a72224 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -120,7 +120,7 @@ git commit -m "Initial User Config." if [ -n "$github_repo" ]; then git remote add origin "$github_repo" - git push --set-upstream origin $(git branch --show-current) + git push --set-upstream origin $(git symbolic-ref --short HEAD) # TODO: Support determing the actions URL when non-https:// repo URL is used. if [ "${github_repo}" != "${github_repo#https://}" ]; then -- cgit v1.2.3 From e2848c66c305442badd2b21a414c1a8fe89cd4fd Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Sat, 8 Aug 2020 17:28:00 -0400 Subject: Fix to archive the .hex files for proton-c build. * Closes #77. --- docs/static/setup.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/static') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 1a72224..327fc84 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -113,6 +113,11 @@ sed -i \ -e "s/KEYBOARD_TITLE/$shield_title/" \ .github/workflows/build.yml +if [ "$board" == "proton_c" ]; then + # Proton-C board still fa + sed -i -e "s/uf2/hex/g" .github/workflows/build.yml +fi + rm -rf .git git init . git add . -- cgit v1.2.3 From 851d54ad960cbcb914cef83c9d1f7fcec49ecf21 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 10 Aug 2020 12:37:05 -0400 Subject: Add Corne to setup.sh script. --- docs/static/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/static') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 327fc84..4208943 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -37,7 +37,7 @@ echo "" echo "Keyboard Shield Selection:" prompt="Pick an keyboard:" -options=("Kyria" "Lily58") +options=("Kyria" "Lily58" "Corne") PS3="$prompt " # TODO: Add support for "Other" and linking to docs on adding custom shields in user config repos. @@ -48,6 +48,7 @@ select opt in "${options[@]}" "Quit"; do 1 ) shield_title="Kyria" shield="kyria"; split="y"; break;; 2 ) shield_title="Lily58" shield="lily58"; split="y"; break;; + 3 ) shield_title="Corne" shield="corne"; split="y"; break;; # Add link to docs on adding your own custom shield in your ZMK config! # $(( ${#options[@]}+1 )) ) echo "Other!"; break;; -- cgit v1.2.3 From b0c648ad57d138c462fac538c7ea25f88b03e443 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 10 Aug 2020 22:47:18 -0400 Subject: Revert usage of `read -i` for macOS compat. --- docs/static/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/static') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 4208943..ce2fe25 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -64,10 +64,10 @@ if [ -z "$copy_keymap" ] || [ "$copy_keymap" == "Y" ] || [ "$copy_keymap" == "y" read -e -p "GitHub Username (leave empty to skip GitHub repo creation): " github_user if [ -n "$github_user" ]; then - read -e -i "zmk-config" -p "GitHub Repo Name: " repo_name + read -p "GitHub Repo Name [zmk-config]: " repo_name if [ -z "$repo_name" ]; then repo_name="zmk-config"; fi - read -e -i "https://github.com/${github_user}/${repo_name}.git" -p "GitHub Repo: " github_repo + read -p "GitHub Repo [https://github.com/${github_user}/${repo_name}.git]: " github_repo if [ -z "$github_repo" ]; then github_repo="https://github.com/${github_user}/${repo_name}.git"; fi else -- cgit v1.2.3 From 47dbba21849a136797014f4691c999de28073bf3 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 11 Aug 2020 08:40:13 -0400 Subject: Fix sed -i usage on macOS, accept 'Y'. --- docs/static/setup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'docs/static') diff --git a/docs/static/setup.sh b/docs/static/setup.sh index ce2fe25..27dcb0b 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -90,7 +90,7 @@ fi echo "" read -p "Continue? [Yn]: " do_it -if [ -n "$do_it" ] && [ "$do_it" != "y" ]; then +if [ -n "$do_it" ] && [ "$do_it" != "y" ] && [ "$do_it" != "Y" ]; then echo "Aborting..." exit fi @@ -108,7 +108,7 @@ fi popd -sed -i \ +sed -i'.orig' \ -e "s/BOARD_NAME/$board/" \ -e "s/SHIELD_NAME/$shield/" \ -e "s/KEYBOARD_TITLE/$shield_title/" \ @@ -116,9 +116,11 @@ sed -i \ if [ "$board" == "proton_c" ]; then # Proton-C board still fa - sed -i -e "s/uf2/hex/g" .github/workflows/build.yml + sed -i'.orig' -e "s/uf2/hex/g" .github/workflows/build.yml fi +rm .github/workflows/*.yml.orig + rm -rf .git git init . git add . -- cgit v1.2.3