Skip to content

Commit

Permalink
fix: some iterations did not work
Browse files Browse the repository at this point in the history
  • Loading branch information
pabera committed Jan 12, 2024
1 parent 61aa460 commit ee0c47c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions installation/components/setup_hifiberry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ where <status> can be 'enable' or 'disable'"
return 0;;
*)
echo "'$2' is not a valid option. You can choose from:"
for key in "${!hifiberry_descriptions[@]}"; do
description="${hifiberry_descriptions[$key]}"
for key in "${!hifiberry_map[@]}"; do
description="${hifiberry_map[$key]}"
echo "$key) $description"
done
echo "Example usage: ./${script_name} enable hifiberry-dac"
Expand Down Expand Up @@ -77,20 +77,24 @@ check_existing_hifiberry() {
}

prompt_board_list() {
board_count=${#hifiberry_map[@]}

counter=1
echo "Select your HiFiBerry board:"
for key in "${!hifiberry_descriptions[@]}"; do
description="${hifiberry_descriptions[$key]}"
echo "$key) $description"
for key in "${!hifiberry_map[@]}"; do
description="${hifiberry_map[$key]}"
echo "$counter) $description"
((counter++))
done

read -p "Enter your choice (0-9): " choice
read -p "Enter your choice (1-$board_count): " choice

case $choice in
[0])
disable_hifiberry;
exit 1;;
[1-9])
selected_board="${hifiberry_descriptions[$choice]}";
[1-$board_count])
selected_board="${hifiberry_map[$choice]}";
enable_hifiberry "$selected_board";
return 0;;
*)
Expand Down

0 comments on commit ee0c47c

Please sign in to comment.