docker: add Bash 4+ version check for macOS compatibility
The script uses associative arrays (declare -A) which require Bash 4+. macOS ships with Bash 3.2 due to GPLv3 licensing, causing the script to fail with "declare: -A: invalid option". This adds a version check with a helpful error message directing macOS users to install Bash via Homebrew. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8b91ceb7c9
commit
99824628d9
@ -1,6 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ((BASH_VERSINFO[0] < 4)); then
|
||||||
|
if [[ "$OSTYPE" == darwin* ]]; then
|
||||||
|
echo "Bash 4+ required. macOS ships with Bash 3.2." >&2
|
||||||
|
echo "Install via: brew install bash" >&2
|
||||||
|
echo "Then run: /opt/homebrew/bin/bash $0" >&2
|
||||||
|
else
|
||||||
|
echo "Bash 4+ required (current: ${BASH_VERSION})" >&2
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
|
COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
|
||||||
EXTRA_COMPOSE_FILE="$ROOT_DIR/docker-compose.extra.yml"
|
EXTRA_COMPOSE_FILE="$ROOT_DIR/docker-compose.extra.yml"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user