fix(setup): Make keymap/conf fall back to using dirname

This commit is contained in:
Cem Aksoylar
2022-12-16 14:43:47 -08:00
committed by Pete Johanson
parent ebb4cb76d3
commit b8fb218a01
2 changed files with 36 additions and 23 deletions

View File

@@ -205,19 +205,23 @@ cd ${repo_name}
pushd config
if [ "$keyboard_shield" == "y" ]; then
config_file="https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${keyboard_basedir}/${shield}.conf"
keymap_file="https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${keyboard_basedir}/${shield}.keymap"
url_base="https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/shields/${keyboard_basedir}"
else
config_file="https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/${keyboard_arch}/${keyboard_basedir}/${board}.conf"
keymap_file="https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/${keyboard_arch}/${keyboard_basedir}/${board}.keymap"
url_base="https://raw.githubusercontent.com/zmkfirmware/zmk/main/app/boards/${keyboard_arch}/${keyboard_basedir}"
fi
echo "Downloading config file (${url_base}/${keyboard}.conf)"
if ! $download_command "${url_base}/${keyboard}.conf"; then
echo "Could not find it, falling back to ${url_base}/${keyboard_basedir}.conf"
$download_command "${url_base}/${keyboard_basedir}.conf" || echo "# Put configuration options here" > "${keyboard}.conf"
fi
echo "Downloading config file (${config_file})"
$download_command "${config_file}" || echo "# Put configuration options here" > "${keyboard}.conf"
if [ "$copy_keymap" == "yes" ]; then
echo "Downloading keymap file (${keymap_file})"
$download_command "${keymap_file}"
echo "Downloading keymap file (${url_base}/${keyboard}.keymap)"
if ! $download_command "${url_base}/${keyboard}.keymap"; then
echo "Could not find it, falling back to ${url_base}/${keyboard_basedir}.keymap"
$download_command "${url_base}/${keyboard_basedir}.keymap" || echo "Warning: Could not find a keymap file to download!"
fi
fi
popd
@@ -254,7 +258,7 @@ if [ -n "$github_repo" ]; then
echo " git remote rm origin"
echo " git remote add origin FIXED_URL"
echo " git push --set-upstream origin $(git symbolic-ref --short HEAD)"
echo "Once pushed, your firmware should be availalbe from GitHub Actions at: ${github_repo%.git}/actions"
echo "Once pushed, your firmware should be available from GitHub Actions at: ${github_repo%.git}/actions"
exit 1
fi