Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7a55fd

Browse files
authored
Merge pull request ruvnet#135 from ruvnet/fix/install-macos-bash3-compat
fix: install.sh macOS Bash 3.2 compatibility
2 parents da7105d + dc371a6 commit d7a55fd

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

install.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,13 @@ recommend_profile() {
485485
echo " Available profiles based on your system:"
486486
echo ""
487487

488-
local idx=1
489-
declare -A PROFILE_MAP
488+
local idx=0
489+
# Use indexed array instead of associative array for Bash 3.2 (macOS) compatibility
490+
local profile_names=()
490491

491492
for p in "${available_profiles[@]}"; do
492493
local marker=""
494+
idx=$((idx + 1))
493495
if [ "$p" == "$recommended" ]; then
494496
marker=" ${GREEN}(recommended)${RESET}"
495497
fi
@@ -502,13 +504,13 @@ recommend_profile() {
502504
iot) echo -e " ${BOLD}${idx})${RESET} iot - ESP32 sensor mesh + aggregator${marker}" ;;
503505
field) echo -e " ${BOLD}${idx})${RESET} field - WiFi-Mat disaster response kit (~62 MB)${marker}" ;;
504506
esac
505-
PROFILE_MAP[$idx]="$p"
506-
idx=$((idx + 1))
507+
profile_names+=("$p")
507508
done
508509

509510
# Always show full as the last option
511+
idx=$((idx + 1))
510512
echo -e " ${BOLD}${idx})${RESET} full - Install everything available"
511-
PROFILE_MAP[$idx]="full"
513+
profile_names+=("full")
512514

513515
if [ -n "$PROFILE" ]; then
514516
echo ""
@@ -525,8 +527,8 @@ recommend_profile() {
525527

526528
if [ -z "$choice" ]; then
527529
PROFILE="$recommended"
528-
elif [[ -n "${PROFILE_MAP[$choice]+x}" ]]; then
529-
PROFILE="${PROFILE_MAP[$choice]}"
530+
elif [ "$choice" -ge 1 ] 2>/dev/null && [ "$choice" -le "$idx" ]; then
531+
PROFILE="${profile_names[$((choice - 1))]}"
530532
else
531533
echo -e " ${RED}Invalid choice. Using ${recommended}.${RESET}"
532534
PROFILE="$recommended"

0 commit comments

Comments
 (0)