fix: install.sh compatibility with macOS Bash 3.2

Replace `declare -A` (associative array, requires Bash 4+) with
a standard indexed array. macOS ships Bash 3.2 due to GPLv3
licensing, so `declare -A` fails with "invalid option".

Fixes #134

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
ruv 2026-03-04 08:27:02 -05:00
parent 26655d397e
commit dc371a6751

View file

@ -485,11 +485,13 @@ recommend_profile() {
echo " Available profiles based on your system:"
echo ""
local idx=1
declare -A PROFILE_MAP
local idx=0
# Use indexed array instead of associative array for Bash 3.2 (macOS) compatibility
local profile_names=()
for p in "${available_profiles[@]}"; do
local marker=""
idx=$((idx + 1))
if [ "$p" == "$recommended" ]; then
marker=" ${GREEN}(recommended)${RESET}"
fi
@ -502,13 +504,13 @@ recommend_profile() {
iot) echo -e " ${BOLD}${idx})${RESET} iot - ESP32 sensor mesh + aggregator${marker}" ;;
field) echo -e " ${BOLD}${idx})${RESET} field - WiFi-Mat disaster response kit (~62 MB)${marker}" ;;
esac
PROFILE_MAP[$idx]="$p"
idx=$((idx + 1))
profile_names+=("$p")
done
# Always show full as the last option
idx=$((idx + 1))
echo -e " ${BOLD}${idx})${RESET} full - Install everything available"
PROFILE_MAP[$idx]="full"
profile_names+=("full")
if [ -n "$PROFILE" ]; then
echo ""
@ -525,8 +527,8 @@ recommend_profile() {
if [ -z "$choice" ]; then
PROFILE="$recommended"
elif [[ -n "${PROFILE_MAP[$choice]+x}" ]]; then
PROFILE="${PROFILE_MAP[$choice]}"
elif [ "$choice" -ge 1 ] 2>/dev/null && [ "$choice" -le "$idx" ]; then
PROFILE="${profile_names[$((choice - 1))]}"
else
echo -e " ${RED}Invalid choice. Using ${recommended}.${RESET}"
PROFILE="$recommended"