chore: fix update-appup.sh for bash 3.2

This commit is contained in:
Zaiming Shi 2022-03-19 08:42:52 +01:00
parent 72e37dd144
commit 13086e7259
1 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,9 @@ PREV_TAG="$(git describe --tag --match "${TAG_PREFIX}*" | grep -oE "${TAG_PREFIX
PREV_VERSION="${PREV_TAG#[e|v]}" PREV_VERSION="${PREV_TAG#[e|v]}"
shift 1 shift 1
ESCRIPT_ARGS=() # bash 3.2 treat empty array as unbound, so we can't use 'ESCRIPT_ARGS=()' here,
# but must add an empty-string element to the array
ESCRIPT_ARGS=( '' )
while [ "$#" -gt 0 ]; do while [ "$#" -gt 0 ]; do
case $1 in case $1 in
-h|--help) -h|--help)
@ -103,12 +105,15 @@ if [ ! -d "${PREV_TAG}" ]; then
fi fi
popd popd
# bash 3.2 does not allow empty array, so we had to add an empty string in the ESCRIPT_ARGS array,
# this in turn makes quoting "${ESCRIPT_ARGS[@]}" problematic, hence disable SC2068 check here
# shellcheck disable=SC2068
./scripts/update_appup.escript \ ./scripts/update_appup.escript \
--src-dirs "${SRC_DIRS}/**" \ --src-dirs "${SRC_DIRS}/**" \
--release-dir "_build/${PROFILE}/lib" \ --release-dir "_build/${PROFILE}/lib" \
--prev-release-dir "${PREV_DIR_BASE}/${PREV_TAG}/emqx/lib" \ --prev-release-dir "${PREV_DIR_BASE}/${PREV_TAG}/emqx/lib" \
--skip-build \ --skip-build \
"${ESCRIPT_ARGS[@]}" "$PREV_VERSION" ${ESCRIPT_ARGS[@]} "$PREV_VERSION"
if [ "${IS_CHECK:-}" = 'yes' ]; then if [ "${IS_CHECK:-}" = 'yes' ]; then
diffs="$(git diff --name-only | grep -E '\.appup\.src' || true)" diffs="$(git diff --name-only | grep -E '\.appup\.src' || true)"