Skip to content

Commit fcf7611

Browse files
committed
Shellcheck provision.sh
1 parent 2bdf05f commit fcf7611

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

scripts/provision.sh

+37-37
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,35 @@ if [ "$BOARDNAME" = "ALL" ]; then
4848
PROVISION_EMSCRIPTEN=1
4949
PROVISION_EMSCRIPTEN2=1
5050
else
51-
FAMILY=`scripts/get_board_info.py $BOARDNAME 'board.chip["family"]'`
51+
FAMILY=$(scripts/get_board_info.py "$BOARDNAME" 'board.chip["family"]')
5252
if [ "$FAMILY" = "" ]; then
5353
echo "UNKNOWN BOARD ($BOARDNAME)"
5454
return 1
5555
fi
56-
export PROVISION_$FAMILY=1
57-
export PROVISION_$BOARDNAME=1
58-
if python scripts/get_makefile_decls.py $BOARDNAME | grep NRF_SDK17; then
56+
export PROVISION_"$FAMILY"=1
57+
export PROVISION_"$BOARDNAME"=1
58+
if python scripts/get_makefile_decls.py "$BOARDNAME" | grep NRF_SDK17; then
5959
PROVISION_NRF_SDK17=1
6060
fi
61-
if python scripts/get_makefile_decls.py $BOARDNAME | grep NRF_SDK15_3; then
61+
if python scripts/get_makefile_decls.py "$BOARDNAME" | grep NRF_SDK15_3; then
6262
PROVISION_NRF_SDK15_3=1
63-
elif python scripts/get_makefile_decls.py $BOARDNAME | grep NRF_SDK15; then
63+
elif python scripts/get_makefile_decls.py "$BOARDNAME" | grep NRF_SDK15; then
6464
PROVISION_NRF_SDK15=1
6565
fi
6666
fi
67-
echo Provision BOARDNAME = $BOARDNAME
68-
echo Provision FAMILY = $FAMILY
67+
echo Provision BOARDNAME = "$BOARDNAME"
68+
echo Provision FAMILY = "$FAMILY"
6969

7070
if pip --version 2>/dev/null; then
7171
echo Python/pip installed
7272
else
7373
echo Installing python/pip
7474
sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq -y python python3-pip
7575
fi
76-
echo Python version `python --version`
76+
echo Python version "$(python --version)"
7777

7878
if [ "$PROVISION_ESP32" = "1" ]; then
79-
echo ===== ESP32
79+
echo "===== ESP32"
8080
# needed for esptool for merging binaries
8181
if pip list 2>/dev/null | grep pyserial >/dev/null; then
8282
echo pyserial installed;
@@ -104,22 +104,22 @@ if [ "$PROVISION_ESP32" = "1" ]; then
104104
echo "Folder found"
105105
fi
106106
fi
107-
echo ESP_IDF_PATH=`pwd`/esp-idf
108-
echo ESP_APP_TEMPLATE_PATH=`pwd`/app
109-
echo "PATH=\$PATH:`pwd`/xtensa-esp32-elf/bin/"
110-
export ESP_IDF_PATH=`pwd`/esp-idf
111-
export ESP_APP_TEMPLATE_PATH=`pwd`/app
112-
export PATH=$PATH:`pwd`/xtensa-esp32-elf/bin/
113-
echo GCC is $(which xtensa-esp32-elf-gcc)
107+
echo "ESP_IDF_PATH=$(pwd)/esp-idf"
108+
echo "ESP_APP_TEMPLATE_PATH=$(pwd)/app"
109+
echo "PATH=\$PATH:$(pwd)/xtensa-esp32-elf/bin/"
110+
export ESP_IDF_PATH=$(pwd)/esp-idf
111+
export ESP_APP_TEMPLATE_PATH=$(pwd)/app
112+
export PATH=$PATH:$(pwd)/xtensa-esp32-elf/bin/
113+
echo GCC is "$(which xtensa-esp32-elf-gcc)"
114114
fi
115115
#--------------------------------------------------------------------------------
116116
if [ "$PROVISION_ESP32_IDF4" = "1" ]; then
117-
echo ===== ESP32 IDF4
117+
echo "===== ESP32 IDF4"
118118
# SDK
119119
if [ ! -d "esp-idf-4" ]; then
120120
echo installing esp-idf folder
121121
mkdir esp-idf-4
122-
cd esp-idf-4
122+
cd esp-idf-4 || exit
123123
git clone -b v4.4.8 --recursive https://github.com/espressif/esp-idf.git
124124
esp-idf/install.sh # RIC if not specifying the target, it installs all of them for now, selected targets are: esp32c3, esp32, esp32s2, esp32h2, esp32s3
125125
cd ..
@@ -128,7 +128,7 @@ if [ "$PROVISION_ESP32_IDF4" = "1" ]; then
128128
fi
129129
#--------------------------------------------------------------------------------
130130
if [ "$PROVISION_ESP8266" = "1" ]; then
131-
echo ===== ESP8266
131+
echo "===== ESP8266"
132132
if [ ! -d "ESP8266_NONOS_SDK-2.2.1" ]; then
133133
echo ESP8266_NONOS_SDK-2.2.1
134134
curl -Ls https://github.com/espruino/EspruinoBuildTools/raw/master/esp8266/ESP8266_NONOS_SDK-2.2.1.tar.gz | tar xfz - --no-same-owner
@@ -142,29 +142,29 @@ if [ "$PROVISION_ESP8266" = "1" ]; then
142142
fi
143143

144144
fi
145-
export ESP8266_SDK_ROOT=`pwd`/ESP8266_NONOS_SDK-2.2.1
146-
export PATH=$PATH:`pwd`/xtensa-lx106-elf/bin/
147-
echo GCC is $(which xtensa-lx106-elf-gcc)
145+
export ESP8266_SDK_ROOT=$(pwd)/ESP8266_NONOS_SDK-2.2.1
146+
export PATH=$PATH:$(pwd)/xtensa-lx106-elf/bin/
147+
echo GCC is "$(which xtensa-lx106-elf-gcc)"
148148
fi
149149
#--------------------------------------------------------------------------------
150150
if [ "$PROVISION_LINUX" = "1" ]; then
151-
echo ===== LINUX
151+
echo "===== LINUX"
152152
fi
153153
#--------------------------------------------------------------------------------
154154
if [ "$PROVISION_RASPBERRYPI" = "1" ]; then
155-
echo ===== RASPBERRYPI
155+
echo "===== RASPBERRYPI"
156156
if [ ! -d "targetlibs/raspberrypi" ]; then
157157
echo Installing Raspberry pi tools
158158
mkdir targetlibs/raspberrypi
159-
cd targetlibs/raspberrypi
159+
cd targetlibs/raspberrypi || exit
160160
git clone --depth=1 https://github.com/raspberrypi/tools
161161
# wiringpi?
162162
cd ../..
163163
fi
164164
fi
165165
#--------------------------------------------------------------------------------
166166
if [ "$PROVISION_NRF52" = "1" ]; then
167-
echo ===== NRF52
167+
echo "===== NRF52"
168168
if ! type nrfutil 2> /dev/null > /dev/null; then
169169
#echo Installing nrfutil
170170
#sudo pip install --ignore-installed nrfutil nrfutil
@@ -186,7 +186,7 @@ if [ "$PROVISION_NRF52" = "1" ]; then
186186
fi
187187
# Because nrfutil doesn't support the latest version of python! Yay!
188188
echo Installing nrfutil
189-
sudo pipx install nrfutil --python `which python3.8`
189+
sudo pipx install nrfutil --python "$(which python3.8)"
190190
fi
191191
ARM=1
192192

@@ -205,9 +205,9 @@ if [ "$PROVISION_NRF_SDK15" = "1" ]; then
205205
rm -rf nRF5_SDK_15.0.0_a53641a/external
206206
cp -r nRF5_SDK_15.0.0_a53641a/* targetlibs/nrf5x_15
207207
rm -rf nRF5_SDK_15.0.0_a53641a.zip nRF5_SDK_15.0.0_a53641a
208-
echo ======================================================
208+
echo "======================================================"
209209
echo "FIXME - SDK15 NFC patches don't apply cleanly"
210-
echo ======================================================
210+
echo "======================================================"
211211
cat targetlibs/nrf5x_15/patches/* | patch -p1 || true
212212
fi
213213
fi
@@ -221,9 +221,9 @@ if [ "$PROVISION_NRF_SDK15_3" = "1" ]; then
221221
rm -rf nRF5_SDK_15.3.0_59ac345/external
222222
cp -r nRF5_SDK_15.3.0_59ac345/* targetlibs/nrf5x_15_3
223223
rm -rf nRF5_SDK_15.3.0_59ac345.zip nRF5_SDK_15.3.0_59ac345
224-
echo ======================================================
224+
echo "======================================================"
225225
echo "FIXME - SDK15 NFC patches don't apply cleanly"
226-
echo ======================================================
226+
echo "======================================================"
227227
cat targetlibs/nrf5x_15_3/patches/* | patch -p1 || true
228228
fi
229229
fi
@@ -237,7 +237,7 @@ if [ "$PROVISION_NRF_SDK17" = "1" ]; then
237237
rm -rf nRF5_SDK_17.0.2_d674dde/external
238238
cp -r nRF5_SDK_17.0.2_d674dde/* targetlibs/nrf5x_17
239239
rm -rf nRF5_SDK_17.zip nRF5_SDK_17.0.2_d674dde
240-
echo ======================================================
240+
echo "======================================================"
241241
cat targetlibs/nrf5x_17/patches/* | patch -p1
242242
fi
243243
fi
@@ -270,7 +270,7 @@ fi
270270

271271
if [ "$ARM" = "1" ]; then
272272
# defaulting to ARM
273-
echo ===== ARM
273+
echo "===== ARM"
274274
EXPECTEDARMGCCVERSION="13.2.1"
275275
EXPECTEDARMGCCFILENAME="arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi"
276276
if type arm-none-eabi-gcc 2> /dev/null > /dev/null; then
@@ -303,19 +303,19 @@ if [ "$ARM" = "1" ]; then
303303
else
304304
echo "Folder found"
305305
fi
306-
export PATH=$PATH:`pwd`/$EXPECTEDARMGCCFILENAME/bin
306+
export PATH=$PATH:$(pwd)/$EXPECTEDARMGCCFILENAME/bin
307307
fi
308308
fi
309309

310310
#--------------------------------------------------------------------------------
311311
EMSCRIPTEN_VERSION="3.1.54"
312312

313313
if [ "$PROVISION_EMSCRIPTEN" = "1" ] || [ "$PROVISION_EMSCRIPTEN2" = "1" ]; then
314-
echo ===== EMULATOR
314+
echo "===== EMULATOR"
315315
echo Installing Emscripten $EMSCRIPTEN_VERSION
316316
if [ ! -d "targetlibs/emscripten/emsdk" ]; then
317317
mkdir targetlibs/emscripten
318-
cd targetlibs/emscripten
318+
cd targetlibs/emscripten || exit
319319
git clone --depth=1 https://github.com/emscripten-core/emsdk
320320
cd ../..
321321
fi

0 commit comments

Comments
 (0)