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