Skip to content

fix: fix bash syntax error when running run_macaron.sh on MacOS #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/source/pages/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ Installation Guide
-------------
Prerequisites
-------------
- Installations of ``wget`` or ``curl`` and ``bash`` must be available and on the path.
- Installations of ``wget`` or ``curl`` and ``bash`` must be available on ``PATH``.

- Macaron has been tested with ``bash 5.1.16(1)-release``.

- Docker (or docker equivalent for your host OS) must be installed, with a docker command line equivalent to Docker 17.06 (Oracle Container Runtime 19.03) and the user should be a member of the operating system group ``docker`` (to run Docker in `rootless mode <https://docs.docker.com/engine/security/rootless/>`_).

.. _download-macaron:
Expand Down
26 changes: 21 additions & 5 deletions scripts/release_scripts/run_macaron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@
# Reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -euo pipefail

# The `extglob` shopt option is required for the `@(...)` pattern matching syntax.
# This option is not enabled by default for bash on some systems, most notably MacOS
# where the default bash version is very old.
# Reference: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
shopt -s extglob

# Log error (to stderr).
log_err() {
echo "[ERROR]: $*" >&2
}

# Log warning (to stderr).
log_warning() {
echo "[WARNING]: $*" >&2
}

if [[ "${BASH_VERSINFO[0]}" -lt "4" ]]; then
log_warning "Your bash version, '${BASH_VERSION}', is too old and is not actively supported by Macaron."
log_warning "Using bash version >=4 is recommended."
fi

if [[ -z ${MACARON_IMAGE_TAG:-} ]]; then
MACARON_IMAGE_TAG="latest"
fi
Expand Down Expand Up @@ -57,11 +78,6 @@ mounts=()
# The proxy values obtained from the host environment.
proxy_vars=()

# Log error (to stderr).
log_err() {
echo "[ERROR]: $*" >&2
}

# Convert a path to absolute path if it is a relative path.
#
# Arguments:
Expand Down