From cd194dbac4747126f017ce6e9ddf070ca6cc1fef Mon Sep 17 00:00:00 2001 From: CrossR Date: Thu, 24 Sep 2020 17:42:34 +0100 Subject: [PATCH] Add licenses. --- docs/static/setup.ps1 | 8 ++++++-- docs/static/setup.sh | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/static/setup.ps1 b/docs/static/setup.ps1 index a2d66eec..3946e66c 100644 --- a/docs/static/setup.ps1 +++ b/docs/static/setup.ps1 @@ -1,3 +1,7 @@ +# Copyright (c) 2020 The ZMK Contributors +# +# SPDX-License-Identifier: MIT + $ErrorActionPreference = "Stop" function Get-Choice-From-Options { @@ -10,7 +14,7 @@ function Get-Choice-From-Options { for ($i = 0; $i -lt $Options.length; $i++) { Write-Host "$($i + 1)) $($Options[$i])" } - + Write-Host "$($Options.length + 1)) Quit" $selection = Read-Host $Prompt @@ -103,7 +107,7 @@ if ($github_user -ne "") { } $github_repo = Read-Host "GitHub Repo [https://github.com/$github_user/$repo_name.git]" - + if ($github_repo -eq "") { $github_repo = "https://github.com/$github_user/$repo_name.git" } diff --git a/docs/static/setup.sh b/docs/static/setup.sh index df985a67..5bf36451 100644 --- a/docs/static/setup.sh +++ b/docs/static/setup.sh @@ -1,11 +1,15 @@ #!/bin/bash +# Copyright (c) 2020 The ZMK Contributors +# +# SPDX-License-Identifier: MIT + set -e check_exists() { command_to_run=$1 error_message=$2 - + if ! eval "$command_to_run" &> /dev/null; then printf "%s\n" "$error_message" exit 1 @@ -28,7 +32,7 @@ echo "$title" echo "" echo "MCU Board Selection:" PS3="$prompt " -select opt in "${options[@]}" "Quit"; do +select opt in "${options[@]}" "Quit"; do case "$REPLY" in @@ -50,8 +54,8 @@ options=("Kyria" "Lily58" "Corne" "Splitreus62" "Sofle" "Iris" "RoMac") 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[@]}" "Quit"; do +# select opt in "${options[@]}" "Other" "Quit"; do +select opt in "${options[@]}" "Quit"; do case "$REPLY" in @@ -64,7 +68,7 @@ select opt in "${options[@]}" "Quit"; do 7 ) shield_title="RoMac" shield="romac"; split="n"; break;; # Add link to docs on adding your own custom shield in your ZMK config! - # $(( ${#options[@]}+1 )) ) echo "Other!"; break;; + # $(( ${#options[@]}+1 )) ) echo "Other!"; break;; $(( ${#options[@]}+1 )) ) echo "Goodbye!"; exit 1;; *) echo "Invalid option. Try another one.";continue;; @@ -148,9 +152,10 @@ git commit -m "Initial User Config." if [ -n "$github_repo" ]; then git remote add origin "$github_repo" git push --set-upstream origin "$(git symbolic-ref --short HEAD)" + push_return_code=$? # If push failed, assume that the origin was incorrect and give instructions on fixing. - if [ $? -ne 0 ] { + if [ ${push_return_code} -ne 0 ]; then echo "Remote repository $github_repo not found..." echo "Check GitHub URL, and try adding again." echo "Run the following: " @@ -159,7 +164,7 @@ if [ -n "$github_repo" ]; then 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" exit 1 - } + fi # TODO: Support determing the actions URL when non-https:// repo URL is used. if [ "${github_repo}" != "${github_repo#https://}" ]; then