@@ -143,16 +143,19 @@ function setup_ubuntu_install_dependencies() {
143143 exit 1
144144 fi
145145
146- cd " level-zero-${ONE_API_GPU_VER} " || exit 1
146+ pushd " level-zero-${ONE_API_GPU_VER} " > /dev/null || exit 1
147147
148148 if mkdir build; then
149149 rm -rf build
150150 mkdir build
151151 fi
152- cd build || exit 1
152+ pushd build > /dev/null || exit 1
153153 cmake .. -D CMAKE_BUILD_TYPE=Release
154154 cmake --build . --target package -j" ${nproc} "
155155 cmake --build . --target install -j" ${nproc} "
156+ popd > /dev/null
157+ popd > /dev/null
158+ rm -rf " ${setup_script_folder} /level-zero-${ONE_API_GPU_VER} "
156159 fi
157160
158161 if [ " ${ECOSYSTEM_BUILD_AND_INSTALL_FFMPEG_PLUGIN} " == " 1" ]; then
@@ -253,7 +256,7 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
253256 if [ " ${SETUP_BUILD_AND_INSTALL_GPU_DIRECT} " == " 1" ]; then
254257 echo " $STEP Install the build dependency for GPU Direct"
255258 # shellcheck disable=SC1091
256- cd " ${root_folder} /gpu_direct" || exit 1
259+ pushd " ${root_folder} /gpu_direct" > /dev/null || exit 1
257260
258261 if [[ " :$LIBRARY_PATH :" != * " :/usr/local/lib:" * ]]; then
259262 export LIBRARY_PATH=" /usr/local/lib:$LIBRARY_PATH "
@@ -268,6 +271,8 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
268271 echo " mtl_gpu_direct is NOT available via pkg-config."
269272 fi
270273
274+ popd > /dev/null
275+
271276 STEP=$(( STEP + 1 ))
272277 fi
273278
@@ -290,21 +295,25 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
290295 if [ -z " $setup_script_folder " ] || [ -z " $ICE_VER " ] || [ -z " $ICE_DMID " ]; then
291296 exit 3
292297 fi
293- cd " ${setup_script_folder} "
298+ pushd " ${setup_script_folder} " > /dev/null || exit 1
294299
295300 echo " Building e810 driver version: $ICE_VER form mirror $ICE_DMID "
296301
297302 wget " https://downloadmirror.intel.com/${ICE_DMID} /ice-${ICE_VER} .tar.gz"
298303 tar xvzf " ice-${ICE_VER} .tar.gz"
299- cd " ice-${ICE_VER} "
304+ pushd " ice-${ICE_VER} " > /dev/null || exit 1
300305
301306 git init
302307 git add .
303308 git commit -m " init version ${ICE_VER} "
304309 git am " ${root_folder} " /patches/ice_drv/" ${ICE_VER} " /* .patch
305310
306- cd src
311+ pushd src > /dev/null || exit 1
307312 make -j" ${nproc} "
313+ popd > /dev/null
314+ popd > /dev/null
315+ rm -rf " ice-${ICE_VER} " " ice-${ICE_VER} .tar.gz"
316+ popd > /dev/null
308317 STEP=$(( STEP + 1 ))
309318 fi
310319
@@ -318,40 +327,48 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
318327
319328 if [ " ${MTL_BUILD_AND_INSTALL_DEBUG} " == " 1" ]; then
320329 echo " $STEP MTL debug build and install"
321- cd " ${root_folder} " && ./build.sh debug
330+ pushd " ${root_folder} " > /dev/null || exit 1
331+ ./build.sh debug
332+ popd > /dev/null
322333 STEP=$(( STEP + 1 ))
323334 fi
324335
325336 if [ " ${MTL_BUILD_AND_INSTALL} " == " 1" ]; then
326337 echo " $STEP MTL build and install"
327- cd " ${root_folder} " && ./build.sh
338+ pushd " ${root_folder} " > /dev/null || exit 1
339+ ./build.sh
340+ popd > /dev/null
328341 STEP=$(( STEP + 1 ))
329342 fi
330343
331344 if [ " ${MTL_BUILD_AND_INSTALL_DOCKER} " == " 1" ]; then
332345 echo " $STEP MTL docker build and install"
333- cd " ${root_folder} /docker" || exit 1
346+ pushd " ${root_folder} /docker" > /dev/null || exit 1
334347
335348 if [ -n " ${http_proxy} " ] && [ -n " ${https_proxy} " ]; then
336349 docker build -t mtl:latest -f ubuntu.dockerfile --build-arg HTTP_PROXY=" ${http_proxy} " --build-arg HTTPS_PROXY=" ${https_proxy} " ../
337350 else
338351 docker build -t mtl:latest -f ubuntu.dockerfile ../
339352 fi
340353
354+ popd > /dev/null
355+
341356 STEP=$(( STEP + 1 ))
342357 fi
343358
344359 if [ " ${MTL_BUILD_AND_INSTALL_DOCKER_MANAGER} " == " 1" ]; then
345360 echo " $STEP MTL docker manager build and install"
346361
347- cd " ${root_folder} /manager" | exit 1
362+ pushd " ${root_folder} /manager" > /dev/null | | exit 1
348363
349364 if [ -n " ${http_proxy} " ] && [ -n " ${https_proxy} " ]; then
350365 docker build --build-arg VERSION=" $( cat ../VERSION) " -t mtl-manager:latest --build-arg HTTP_PROXY=" ${http_proxy} " --build-arg HTTPS_PROXY=" ${https_proxy} " .
351366 else
352367 docker build --build-arg VERSION=" $( cat ../VERSION) " -t mtl-manager:latest .
353368 fi
354369
370+ popd > /dev/null
371+
355372 STEP=$(( STEP + 1 ))
356373 fi
357374
@@ -372,7 +389,9 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
372389 if [ " ${ECOSYSTEM_BUILD_AND_INSTALL_GSTREAMER_PLUGIN} " == " 1" ]; then
373390 echo " $STEP Ecosystem GStreamer plugin build and install"
374391
375- bash " ${root_folder} /ecosystem/gstreamer_plugin/build.sh"
392+ pushd " ${root_folder} /ecosystem/gstreamer_plugin" > /dev/null || exit 1
393+ bash build.sh
394+ popd > /dev/null
376395 STEP=$(( STEP + 1 ))
377396 fi
378397
@@ -390,20 +409,23 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
390409
391410 if [ " ${ECOSYSTEM_BUILD_AND_INSTALL_OBS_PLUGIN} " == " 1" ]; then
392411 echo " $STEP Ecosystem OBS plugin build and install"
393- cd " ${root_folder} /ecosystem/obs_mtl" || exit 1
394- cd linux-mtl
412+ pushd " ${root_folder} /ecosystem/obs_mtl" > /dev/null || exit 1
413+ pushd linux-mtl > /dev/null || exit 1
395414 meson setup build
396415 meson compile -C build
397416 meson install -C build
417+ popd > /dev/null
418+ popd > /dev/null
398419 STEP=$(( STEP + 1 ))
399420 fi
400421
401422 if [ " ${PLUGIN_BUILD_AND_INSTALL_SAMPLE} " == " 1" ]; then
402423 echo " $STEP Plugin sample build and install"
403- cd " ${root_folder} /plugins" || exit 1
424+ pushd " ${root_folder} /plugins" > /dev/null || exit 1
404425 meson setup build
405426 meson compile -C build
406427 meson install -C build
428+ popd > /dev/null
407429 STEP=$(( STEP + 1 ))
408430 fi
409431
@@ -421,53 +443,60 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
421443
422444 if [ " ${HOOK_PYTHON} " == " 1" ]; then
423445 echo " $STEP Hook Python"
424- cd " ${root_folder} " || exit 1
446+ pushd " ${root_folder} " > /dev/null || exit 1
425447 if [ -d swig ]; then
426448 echo " SWIG directory already exists, skipping clone."
427449 else
428450 echo " Cloning SWIG repository..."
429451 git clone https://github.com/swig/swig.git
430452 fi
431- cd swig/
453+ pushd swig > /dev/null || exit 1
432454 git checkout v4.1.1
433455 ./autogen.sh
434456 ./configure
435457 make -j" ${nproc} "
436458 make install
437- cd " ${root_folder} /python/swig"
459+ popd > /dev/null
460+ pushd " ${root_folder} /python/swig" > /dev/null || exit 1
438461 swig -python -I/usr/local/include -o pymtl_wrap.c pymtl.i
439462 python3 setup.py build_ext --inplace
440463 python3 setup.py install
464+ popd > /dev/null
465+ popd > /dev/null
441466 STEP=$(( STEP + 1 ))
442467 fi
443468
444469 if [ " ${HOOK_RUST} " == " 1" ]; then
445470 echo " $STEP Hook Rust"
446- cd " ${root_folder} /rust" || exit 1
471+ pushd " ${root_folder} /rust" > /dev/null || exit 1
447472 cargo update home --precise " ${RUST_HOOK_CARGO_VER} "
448473 cargo build --release
474+ popd > /dev/null
449475 STEP=$(( STEP + 1 ))
450476 fi
451477
452478 if [ " ${TOOLS_BUILD_AND_INSTALL_MTL_MONITORS} " == " 1" ]; then
453479 echo " $STEP Tools MTL monitors build and install"
454- cd " ${root_folder} /tools/ebpf" || exit 1
480+ pushd " ${root_folder} /tools/ebpf" > /dev/null || exit 1
455481 make lcore_monitor -j" ${nproc} "
456482 make udp_monitor -j" ${nproc} "
483+ popd > /dev/null
457484 STEP=$(( STEP + 1 ))
458485 fi
459486
460487 if [ " ${TOOLS_BUILD_AND_INSTALL_MTL_READPCAP} " == " 1" ]; then
461488 echo " $STEP Tools MTL readpcap build and install"
462- cd " ${root_folder} /tools/readpcap" || exit 1
489+ pushd " ${root_folder} /tools/readpcap" > /dev/null || exit 1
463490 make -j" ${nproc} "
491+ popd > /dev/null
464492 STEP=$(( STEP + 1 ))
465493 fi
466494
467495 if [ " ${TOOLS_BUILD_AND_INSTALL_MTL_CPU_EMULATOR} " == " 1" ]; then
468496 echo " $STEP Tools MTL CPU emulator build and install"
469- cd " ${root_folder} /tools/sch_smi_emulate" || exit 1
497+ pushd " ${root_folder} /tools/sch_smi_emulate" > /dev/null || exit 1
470498 make -j" ${nproc} "
499+ popd > /dev/null
471500 STEP=$(( STEP + 1 ))
472501 fi
473502
0 commit comments