From e9ef377a168543d1110254c411e1cf9733322dfd Mon Sep 17 00:00:00 2001 From: Brett Higgins Date: Tue, 4 Mar 2025 10:34:26 -0500 Subject: [PATCH] Fix unbound variable error in install script --- install/_lib.sh | 1 - install/check-minimum-requirements.sh | 8 ++++---- install/dc-detect-version.sh | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/install/_lib.sh b/install/_lib.sh index ee7bb43520..e4ce0aaaa4 100644 --- a/install/_lib.sh +++ b/install/_lib.sh @@ -56,7 +56,6 @@ function ensure_file_from_example { # Check the version of $1 is greater than or equal to $2 using sort. Note: versions must be stripped of "v" function vergte() { printf "%s\n%s" $1 $2 | sort --version-sort --check=quiet --reverse - echo $? } SENTRY_CONFIG_PY=sentry/sentry.conf.py diff --git a/install/check-minimum-requirements.sh b/install/check-minimum-requirements.sh index fa27588272..e2d1506615 100644 --- a/install/check-minimum-requirements.sh +++ b/install/check-minimum-requirements.sh @@ -8,26 +8,26 @@ if [[ -z "$DOCKER_VERSION" ]]; then exit 1 fi -if [[ "$(vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION)" -eq 1 ]]; then +if ! vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION ; then echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION" exit 1 fi echo "Found Docker version $DOCKER_VERSION" -if [[ "$(vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION)" -eq 1 ]]; then +if ! vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION ; then echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION" exit 1 fi echo "Found Docker Compose version $COMPOSE_VERSION" CPU_AVAILABLE_IN_DOCKER=$(docker run --rm busybox nproc --all) -if [[ "$CPU_AVAILABLE_IN_DOCKER" -lt "$MIN_CPU_HARD" ]]; then +if [[ "$CPU_AVAILABLE_IN_DOCKER" -lt "$MIN_CPU_HARD" ]] ; then echo "FAIL: Required minimum CPU cores available to Docker is $MIN_CPU_HARD, found $CPU_AVAILABLE_IN_DOCKER" exit 1 fi RAM_AVAILABLE_IN_DOCKER=$(docker run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}') -if [[ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM_HARD" ]]; then +if [[ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM_HARD" ]] ; then echo "FAIL: Required minimum RAM available to Docker is $MIN_RAM_HARD MB, found $RAM_AVAILABLE_IN_DOCKER MB" exit 1 fi diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index a27dd7b84a..4b4ad79e54 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -21,7 +21,7 @@ if [[ -z "$COMPOSE_VERSION" && -z "$STANDALONE_COMPOSE_VERSION" ]]; then fi if [[ ! -z "${STANDALONE_COMPOSE_VERSION}" ]]; then - if [[ "$(vergte ${COMPOSE_VERSION//v/} ${STANDALONE_COMPOSE_VERSION//v/})" -eq 1 ]]; then + if ! vergte ${COMPOSE_VERSION//v/} ${STANDALONE_COMPOSE_VERSION//v/}; then COMPOSE_VERSION="${STANDALONE_COMPOSE_VERSION}" dc_base="$dc_base_standalone" fi