Skip to content

Commit

Permalink
Fix unbound variable error in install script
Browse files Browse the repository at this point in the history
  • Loading branch information
brettdh committed Mar 5, 2025
1 parent d885dd3 commit e9ef377
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion install/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions install/check-minimum-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion install/dc-detect-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e9ef377

Please sign in to comment.