diff --git a/deploy.sh b/deploy.sh index 3b2a4b7..5e1fac6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -12,6 +12,13 @@ ENV_FILE="${BOOTSTRAP_DIR}/.env.deploy" COMPOSE_FILE="${BOOTSTRAP_DIR}/docker-compose.yml" CADDYFILE="${BOOTSTRAP_DIR}/Caddyfile" +# Bash 4+ is required for associative arrays (used by i18n and others), so +# check before sourcing anything — macOS ships bash 3.2 as /bin/bash. +if ((BASH_VERSINFO[0] < 4)); then + echo "Error: Bash 4+ is required (found ${BASH_VERSION}). On macOS, install a newer bash (e.g. 'brew install bash') and re-run with it." >&2 + exit 1 +fi + # shellcheck source=lib/i18n.sh source "${BOOTSTRAP_DIR}/lib/i18n.sh" source "${BOOTSTRAP_DIR}/lib/ui.sh" diff --git a/i18n/en.sh b/i18n/en.sh index a67bc12..1daaa61 100644 --- a/i18n/en.sh +++ b/i18n/en.sh @@ -9,7 +9,6 @@ MSG[aborted]="Aborted." MSG[enter_to_keep]="(Enter to keep default)" # -- preflight ------------------------------------------------------------- -MSG[err_bash_version]="Bash 4+ is required (found %s). Install a newer bash." MSG[err_need_docker]="Docker is not installed or not on PATH. See https://docs.docker.com/get-docker/" MSG[err_docker_daemon]="The Docker daemon is not reachable. Is Docker running?" MSG[err_need_compose]="Docker Compose v2 is required ('docker compose'). Update Docker Desktop or install the compose plugin." diff --git a/i18n/ru.sh b/i18n/ru.sh index 2eaf10f..d9f22e0 100644 --- a/i18n/ru.sh +++ b/i18n/ru.sh @@ -9,7 +9,6 @@ MSG[aborted]="Прервано." MSG[enter_to_keep]="(Enter — оставить по умолчанию)" # -- preflight ------------------------------------------------------------- -MSG[err_bash_version]="Требуется Bash 4+ (найден %s). Установите более новый bash." MSG[err_need_docker]="Docker не установлен или не в PATH. См. https://docs.docker.com/get-docker/" MSG[err_docker_daemon]="Демон Docker недоступен. Docker запущен?" MSG[err_need_compose]="Требуется Docker Compose v2 ('docker compose'). Обновите Docker Desktop или установите плагин compose." diff --git a/lib/checks.sh b/lib/checks.sh index de86376..8248cb0 100644 --- a/lib/checks.sh +++ b/lib/checks.sh @@ -1,12 +1,5 @@ # Preflight checks. Fail loud and early with actionable messages. -check_bash() { - if ((BASH_VERSINFO[0] < 4)); then - ui_err "$(t err_bash_version "$BASH_VERSION")" - exit 1 - fi -} - check_docker() { if ! command -v docker >/dev/null 2>&1; then ui_err "$(t err_need_docker)"; exit 1 @@ -38,7 +31,6 @@ is_port_free() { } preflight() { - check_bash check_docker check_openssl ui_ok "$(t preflight_ok)"