make setup.sh prompt for board revision for boards that have revisions
This commit is contained in:
parent
2adaa00d10
commit
557e560213
1 changed files with 31 additions and 0 deletions
|
@ -122,6 +122,9 @@ if [ "$keyboard_shield" == "y" ]; then
|
|||
board_ids=({{#boards}}"{{id}}" {{/boards}})
|
||||
boards_usb_only=({{#boards}}"{{#usb_only}}y{{/usb_only}}{{^usb_only}}n{{/usb_only}}" {{/boards}})
|
||||
|
||||
boards_revisions=({{#boards}}"{{#revisions}}{{.}} {{/revisions}}" {{/boards}})
|
||||
boards_default_revision=({{#boards}}"{{{default_revision}}}" {{/boards}})
|
||||
|
||||
echo ""
|
||||
echo "MCU Board Selection:"
|
||||
PS3="$prompt "
|
||||
|
@ -151,6 +154,34 @@ if [ "$keyboard_shield" == "y" ]; then
|
|||
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "${boards_revisions[$board_index]}" ]; then
|
||||
read -a _valid_revisions <<< "${boards_revisions[$board_index]}"
|
||||
for (( _i=0; _i<${#_valid_revisions}; _i++ )); do
|
||||
if [ "${boards_default_revision[board_index]}" = "${_valid_revisions[_i]}" ]; then
|
||||
_valid_revisions[_i]+=" (default)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "MCU Board Revision:"
|
||||
select opt in "${_valid_revisions[@]}" "Quit"; do
|
||||
''|*[!0-9]*) echo "Invalid option. Try another one."; continue;;
|
||||
|
||||
$(( ${#_valid_revisions[@]}+1 )) ) echo "Goodbye!"; exit 1;;
|
||||
*)
|
||||
if [ $REPLY -gt $(( ${#_valid_revisions[@]}+1 )) ] || [ $REPLY -lt 0 ]; then
|
||||
echo "Invalid option. Try another one."
|
||||
continue
|
||||
fi
|
||||
|
||||
_rev_index=$(( $REPLY-1 ))
|
||||
board="${board_ids[$board_index]}@${_valid_revisions[_rev_index]}"
|
||||
boards=( "${board}" )
|
||||
break
|
||||
;;
|
||||
done
|
||||
fi
|
||||
else
|
||||
board=${keyboard}
|
||||
boards=$keyboard_siblings
|
||||
|
|
Loading…
Add table
Reference in a new issue