summaryrefslogtreecommitdiff
path: root/docs/static/setup.sh
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-08-07 10:02:44 -0400
committerPete Johanson <peter@peterjohanson.com>2020-08-07 10:02:44 -0400
commitccb9b9309a37f55e0aca3c79aa1d78214a42f701 (patch)
treed5b68ff8ea224d313e32dce3f025915419fbbd70 /docs/static/setup.sh
parent5c10517c29696fdc4ba7b7574fbde0e7a68a4589 (diff)
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 `<shield>.conf` from `main` also.
Diffstat (limited to 'docs/static/setup.sh')
-rw-r--r--docs/static/setup.sh30
1 files changed, 24 insertions, 6 deletions
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 .