From bd8e6d8c1580c09ad56db1a1cfbd908558f6c1d8 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 7 Jan 2023 18:05:46 +0200 Subject: [PATCH] docker: Make build.sh more portable --- docker/build.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index b9034a53..3a467b9f 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -20,7 +20,7 @@ export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"} export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"} MACHINE="$(uname -m)" -[[ "$MACHINE" == "arm64" ]] && MACHINE="aarch64" +[ "$MACHINE" = "arm64" ] && MACHINE="aarch64" export GCC_ARM_PATH="gcc-arm-none-eabi-$GCC_ARM_VER" @@ -29,9 +29,9 @@ main() { mkdir -p "$TOOLS_DIR" - [[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]] && GetGcc - [[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk - [[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot + [ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ] && GetGcc + [ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk + [ ! -d "$TOOLS_DIR/mcuboot" ] && GetMcuBoot mkdir -p "$BUILD_DIR" @@ -73,13 +73,13 @@ CmakeGenerate() { CmakeBuild() { local target="$1" - [[ -n "$target" ]] && target="--target $target" - if cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc) - then return 0; else return 1; - fi + [ -n "$target" ] && target="--target $target" + cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc) + BUILD_RESULT=$? + return $BUILD_RESULT } -if [[ $SOURCED == "false" ]]; then +if [ $SOURCED = "false" ]; then # It is important to return exit code of main # To be future-proof, this is handled explicitely main "$@"