diff options
Diffstat (limited to 'docs/static')
-rw-r--r-- | docs/static/setup.sh | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/docs/static/setup.sh b/docs/static/setup.sh index 23ab42b..27dcb0b 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:" @@ -36,17 +37,18 @@ 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. # select opt in "${options[@]}" "Other" "Quit"; do -select opt in "${options[@]}" "Other" "Quit"; do +select opt in "${options[@]}" "Quit"; do case "$REPLY" in 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;; @@ -56,7 +58,11 @@ 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 if [ -z "$repo_name" ]; then repo_name="zmk-config"; fi @@ -72,6 +78,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 @@ -79,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 @@ -87,13 +98,28 @@ fi git clone --single-branch $repo_path ${repo_name} cd ${repo_name} -sed -i \ +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'.orig' \ -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" +if [ "$board" == "proton_c" ]; then + # Proton-C board still fa + sed -i'.orig' -e "s/uf2/hex/g" .github/workflows/build.yml +fi + +rm .github/workflows/*.yml.orig rm -rf .git git init . @@ -102,7 +128,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 |