Skip to content

Commit 9376d78

Browse files
committed
docker: move checks into functions
Move the directory exists checks into the GetX functions. Otherwise we still have the error at firmware-build time instead as expected at container-build time.
1 parent 59f5b12 commit 9376d78

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docker/build.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,8 @@ main() {
3232
mkdir -p "$TOOLS_DIR"
3333

3434
[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ] && GetGcc
35-
if [ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]; then
36-
echo "missing GCC path: $TOOLS_DIR/$GCC_ARM_PATH"
37-
return 1
38-
fi
3935
[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk
40-
if [ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]; then
41-
echo "missing NRF_SDK path: $TOOLS_DIR/$NRF_SDK_VER"
42-
return 1
43-
fi
4436
[ ! -d "$TOOLS_DIR/mcuboot" ] && GetMcuBoot
45-
if [ ! -d "$TOOLS_DIR/mcuboot" ]; then
46-
echo "missing mcuboot path: $TOOLS_DIR/mcuboot"
47-
return 1
48-
fi
4937

5038
mkdir -p "$BUILD_DIR"
5139

@@ -61,17 +49,29 @@ main() {
6149

6250
GetGcc() {
6351
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/$GCC_ARM_VER/$GCC_ARM_PATH-$MACHINE-linux.tar.bz2 -O - | tar -xj -C $TOOLS_DIR/
52+
if [ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]; then
53+
echo "missing GCC path: $TOOLS_DIR/$GCC_ARM_PATH"
54+
return 1
55+
fi
6456
}
6557

6658
GetMcuBoot() {
6759
git clone https://github.com/mcu-tools/mcuboot.git "$TOOLS_DIR/mcuboot"
6860
pip3 install -r "$TOOLS_DIR/mcuboot/scripts/requirements.txt"
61+
if [ ! -d "$TOOLS_DIR/mcuboot" ]; then
62+
echo "missing mcuboot path: $TOOLS_DIR/mcuboot"
63+
return 1
64+
fi
6965
}
7066

7167
GetNrfSdk() {
7268
wget -q "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/$NRF_SDK_VER_SLUG.zip" -O /tmp/$NRF_SDK_VER
7369
unzip -q /tmp/$NRF_SDK_VER -d "$TOOLS_DIR/"
7470
rm /tmp/$NRF_SDK_VER
71+
if [ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]; then
72+
echo "missing NRF_SDK path: $TOOLS_DIR/$NRF_SDK_VER"
73+
return 1
74+
fi
7575
}
7676

7777
CmakeGenerate() {

0 commit comments

Comments
 (0)