Skip to content

Commit bd8e6d8

Browse files
committed
docker: Make build.sh more portable
1 parent fb19c49 commit bd8e6d8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docker/build.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"}
2020
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
2121

2222
MACHINE="$(uname -m)"
23-
[[ "$MACHINE" == "arm64" ]] && MACHINE="aarch64"
23+
[ "$MACHINE" = "arm64" ] && MACHINE="aarch64"
2424

2525
export GCC_ARM_PATH="gcc-arm-none-eabi-$GCC_ARM_VER"
2626

@@ -29,9 +29,9 @@ main() {
2929

3030
mkdir -p "$TOOLS_DIR"
3131

32-
[[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]] && GetGcc
33-
[[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk
34-
[[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot
32+
[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ] && GetGcc
33+
[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk
34+
[ ! -d "$TOOLS_DIR/mcuboot" ] && GetMcuBoot
3535

3636
mkdir -p "$BUILD_DIR"
3737

@@ -73,13 +73,13 @@ CmakeGenerate() {
7373

7474
CmakeBuild() {
7575
local target="$1"
76-
[[ -n "$target" ]] && target="--target $target"
77-
if cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
78-
then return 0; else return 1;
79-
fi
76+
[ -n "$target" ] && target="--target $target"
77+
cmake --build "$BUILD_DIR" --config $BUILD_TYPE $target -- -j$(nproc)
78+
BUILD_RESULT=$?
79+
return $BUILD_RESULT
8080
}
8181

82-
if [[ $SOURCED == "false" ]]; then
82+
if [ $SOURCED = "false" ]; then
8383
# It is important to return exit code of main
8484
# To be future-proof, this is handled explicitely
8585
main "$@"

0 commit comments

Comments
 (0)