-D IE_SHELL_SCRIPT=${script}
-D IE_SHELLCHECK_OUTPUT=${output_file}
-P ${IE_SHELLCHECK_SCRIPT}
- DEPENDS ${script}
+ DEPENDS ${script} ${IE_SHELLCHECK_SCRIPT}
COMMENT "Check script ${script_name}"
VERBATIM)
list(APPEND outputs ${output_file})
message(FATAL_ERROR "IE_SHELLCHECK_OUTPUT is not defined")
endif()
-set(rules "SC1091,SC2236,SC2164,SC2086,SC2162,SC1090")
+set(rules "SC1091,SC2164,SC2162,SC1090")
execute_process(COMMAND ${IE_SHELLCHECK_PROGRAM} --exclude=${rules} ${IE_SHELL_SCRIPT}
OUTPUT_VARIABLE error_message
RESULT_VARIABLE exit_code
fi
if [ -e "$build_dir/CMakeCache.txt" ]; then
- rm -rf "$build_dir/CMakeCache.txt"
+ rm -rf "$build_dir/CMakeCache.txt"
fi
mkdir -p "$build_dir"
cd "$build_dir"
}
export_env_variable() {
- export $2="$DL_SDK_TEMP/test_dependencies/$1"
+ export "$2"="$DL_SDK_TEMP/test_dependencies/$1"
}
ma2480_path=""
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
command -v realpath >/dev/null 2>&1 || { echo >&2 "cpplint require realpath executable but it's not installed. Aborting."; exit 1; }
-SOURCE_DIR=$(realpath ${CURRENT_DIR}/..)
+SOURCE_DIR=$(realpath "${CURRENT_DIR}/..")
REPORT_DIR="${SOURCE_DIR}/report"
CPPLINT_REPORT_DIR="${REPORT_DIR}/cpplint"
PROJECT_NAME="Inference Engine"
function run_cpplint() {
echo "-> CppLint started..."
- if [ -d ${CPPLINT_REPORT_DIR} ]; then
- rm -Rf ${CPPLINT_REPORT_DIR}
+ if [ -d "${CPPLINT_REPORT_DIR}" ]; then
+ rm -Rf "${CPPLINT_REPORT_DIR}"
fi
- mkdir -p ${CPPLINT_REPORT_DIR}
- python ${CURRENT_DIR}/cpplint.py --linelength=160 --counting=detailed --quiet --filter="
+ mkdir -p "${CPPLINT_REPORT_DIR}"
+ python "${CURRENT_DIR}/cpplint.py" --linelength=160 --counting=detailed --quiet --filter="
-build/header_guard,
-build/include,
-build/include_order,
-runtime/explicit,
-readability/todo,
-readability/fn_size
- " $(find ${SOURCE_DIR} -name '*.h' -or -name '*.cc' -or -name '*.c' -or -name '*.cpp' -or -name '*.hpp' |
+ " $(find "${SOURCE_DIR}" -name '*.h' -or -name '*.cc' -or -name '*.c' -or -name '*.cpp' -or -name '*.hpp' |
grep -v 'inference-engine/bin\|inference-engine/build\|inference-engine/report\|inference-engine/scripts\|inference-engine/temp\|inference-engine/tests_deprecated/\|gtest\|inference-engine/ie_bridges\|pugixml\|inference-engine/tools/vpu_perfcheck\|thirdparty/gflags\|thirdparty/ade\|thirdparty/fluid\|thirdparty/mkl-dnn\|thirdparty/movidius\|thirdparty/ocv\|thirdparty/plugixml\|thirdparty/std_lib\|thirdparty/clDNN/common\|thirdparty/clDNN/tutorial\|thirdparty/clDNN/utils' |
grep 'include\|src\|inference-engine/samples\|thirdparty/clDNN/kernel_selector\|thirdparty/clDNN/api\|thirdparty/clDNN/api_extension\|inference-engine/tests_' ) 2>&1 |
sed 's/"/\"/g' >&1| sed 's/</\</g' >&1| sed 's/>/\>/g' >&1| sed "s/'/\'/g" >&1|
- sed 's/\&/\&/g' >&1| python ${CURRENT_DIR}/cpplint_to_cppcheckxml.py &> ${CPPLINT_REPORT_DIR}/cpplint-cppcheck-result.xml
+ sed 's/\&/\&/g' >&1| python "${CURRENT_DIR}/cpplint_to_cppcheckxml.py" &> "${CPPLINT_REPORT_DIR}/cpplint-cppcheck-result.xml"
- # Generate html from it
- ${CURRENT_DIR}/cppcheck-htmlreport.py --file=${CPPLINT_REPORT_DIR}/cpplint-cppcheck-result.xml --report-dir=${CPPLINT_REPORT_DIR} --source-dir=${SOURCE_DIR} --title=${PROJECT_NAME}
+ # Generate html from it
+ "${CURRENT_DIR}/cppcheck-htmlreport.py" --file="${CPPLINT_REPORT_DIR}/cpplint-cppcheck-result.xml" --report-dir="${CPPLINT_REPORT_DIR}" --source-dir="${SOURCE_DIR}" --title="${PROJECT_NAME}"
- # Change Cppcheck things to cpplint
- sed -i.bak 's/Cppcheck/cpplint/g' ${CPPLINT_REPORT_DIR}/index.html
- sed -i.bak 's/a\ tool\ for\ static\ C\/C++\ code\ analysis/an\ open\ source\ lint\-like\ tool\ from\ Google/g' ${CPPLINT_REPORT_DIR}/index.html
- sed -i.bak 's/http:\/\/cppcheck.sourceforge.net/http:\/\/google\-styleguide.googlecode.com\/svn\/trunk\/cpplint\/cpplint.py/g' ${CPPLINT_REPORT_DIR}/index.html
- sed -i.bak 's/IRC: <a href=\"irc:\/\/irc.freenode.net\/cppcheck\">irc:\/\/irc.freenode.net\/cppcheck<\/a>/\ /g' ${CPPLINT_REPORT_DIR}/index.html
+ # Change Cppcheck things to cpplint
+ sed -i.bak 's/Cppcheck/cpplint/g' "${CPPLINT_REPORT_DIR}/index.html"
+ sed -i.bak 's/a\ tool\ for\ static\ C\/C++\ code\ analysis/an\ open\ source\ lint\-like\ tool\ from\ Google/g' "${CPPLINT_REPORT_DIR}/index.html"
+ sed -i.bak 's/http:\/\/cppcheck.sourceforge.net/http:\/\/google\-styleguide.googlecode.com\/svn\/trunk\/cpplint\/cpplint.py/g' "${CPPLINT_REPORT_DIR}/index.html"
+ sed -i.bak 's/IRC: <a href=\"irc:\/\/irc.freenode.net\/cppcheck\">irc:\/\/irc.freenode.net\/cppcheck<\/a>/\ /g' "${CPPLINT_REPORT_DIR}/index.html"
echo "-> CppLint finished..."
}
function run_cpp_check() {
echo "-> Cppcheck started..."
CPPCHECK_REPORT_DIR="${REPORT_DIR}/cppcheck"
- if [ -d ${CPPCHECK_REPORT_DIR} ]; then
- rm -Rf ${CPPCHECK_REPORT_DIR}
+ if [ -d "${CPPCHECK_REPORT_DIR}" ]; then
+ rm -Rf "${CPPCHECK_REPORT_DIR}"
fi
- mkdir -p ${CPPCHECK_REPORT_DIR}
+ mkdir -p "${CPPCHECK_REPORT_DIR}"
- # Generate cppcheck xml
- cppcheck -v --enable=all --suppress=missingIncludeSystem --std=c++11 ${SOURCE_DIR} -i${SOURCE_DIR}/thirdparty -i${SOURCE_DIR}/tests/libs -i${SOURCE_DIR}/temp -i${SOURCE_DIR}/build \
- -i${SOURCE_DIR}/bin -i${SOURCE_DIR}/report -I${SOURCE_DIR}/include -I${SOURCE_DIR}/src -I${SOURCE_DIR}/thirdparty/pugixml/src -I${SOURCE_DIR}/thirdparty/gflags/src -I${SOURCE_DIR}/samples/scoring_agent/HTTPClient -I${SOURCE_DIR}/src/inference_engine --xml-version=2 2> ${CPPCHECK_REPORT_DIR}/cppcheck-only-result.xml
+ # Generate cppcheck xml
+ cppcheck -v --enable=all --suppress=missingIncludeSystem --std=c++11 "${SOURCE_DIR}" -i"${SOURCE_DIR}/thirdparty" -i"${SOURCE_DIR}/tests/libs" -i"${SOURCE_DIR}/temp" -i"${SOURCE_DIR}/build" \
+ -i"${SOURCE_DIR}/bin" -i"${SOURCE_DIR}/report" -I"${SOURCE_DIR}/include" -I"${SOURCE_DIR}/src" -I"${SOURCE_DIR}/thirdparty/pugixml/src" -I"${SOURCE_DIR}/thirdparty/gflags/src" -I"${SOURCE_DIR}/samples/scoring_agent/HTTPClient" -I"${SOURCE_DIR}/src/inference_engine" --xml-version=2 2> "${CPPCHECK_REPORT_DIR}/cppcheck-only-result.xml"
- # Generate html from it
- python ${CURRENT_DIR}/cppcheck-htmlreport.py\
- --file=${CPPCHECK_REPORT_DIR}/cppcheck-only-result.xml\
- --report-dir=${CPPCHECK_REPORT_DIR}\
- --source-dir=${SOURCE_DIR}\
- --title=${PROJECT_NAME}
+ # Generate html from it
+ python "${CURRENT_DIR}/cppcheck-htmlreport.py" \
+ --file="${CPPCHECK_REPORT_DIR}/cppcheck-only-result.xml" \
+ --report-dir="${CPPCHECK_REPORT_DIR}" \
+ --source-dir="${SOURCE_DIR}" \
+ --title="${PROJECT_NAME}"
echo "-> Cppcheck finished..."
}
-if [ ! -d ${REPORT_DIR} ]; then
- mkdir -p ${REPORT_DIR}
+if [ ! -d "${REPORT_DIR}" ]; then
+ mkdir -p "${REPORT_DIR}"
fi
run_cpplint
-out_cpp_lint=`cat ${CPPLINT_REPORT_DIR}/cpplint-cppcheck-result.xml`
-if [[ ${out_cpp_lint} == *"error"* ]]; then
+out_cpp_lint=`cat "${CPPLINT_REPORT_DIR}/cpplint-cppcheck-result.xml"`
+if [[ "${out_cpp_lint}" == *"error"* ]]; then
exit 1
fi
#run_cpp_check
fi
echo "Test directory: ${TEST_DIR}"
-cd ${TEST_DIR}
+cd "${TEST_DIR}"
export IE_VPU_MYRIADX=1
# Wait for all processes to finish
sts=""
for p in ${pids}; do
- if wait ${p}; then
+ if wait "${p}"; then
sts+=" 1"
else
sts+=" 0"
CLONE=false
function print_help {
- echo "Model preprocessing options:"
- echo " -h display this help message"
- echo " -c clone ONNX models repository"
- echo " -m <DIR> set location of the models"
- echo " -f clean target directory(during clone or after enable MSFT models)"
- echo " -e download and prepare MSFT models"
+ echo "Model preprocessing options:"
+ echo " -h display this help message"
+ echo " -c clone ONNX models repository"
+ echo " -m <DIR> set location of the models"
+ echo " -f clean target directory(during clone or after enable MSFT models)"
+ echo " -e download and prepare MSFT models"
}
while getopts ":hcefm:" opt; do
- case ${opt} in
- h )
- print_help
- ;;
- \? )
- print_help
- ;;
- : )
- print_help
- ;;
- c )
- CLONE=true
- ;;
- m )
- MODELS_DIR=$OPTARG
- ;;
- f )
- CLEAN_DIR=true
- ;;
- e )
- ENABLE_MSFT=true
- ;;
- esac
+ case ${opt} in
+ h )
+ print_help
+ ;;
+ \? )
+ print_help
+ ;;
+ : )
+ print_help
+ ;;
+ c )
+ CLONE=true
+ ;;
+ m )
+ MODELS_DIR="$OPTARG"
+ ;;
+ f )
+ CLEAN_DIR=true
+ ;;
+ e )
+ ENABLE_MSFT=true
+ ;;
+ esac
done
shift $((OPTIND -1))
-if [ $MODELS_DIR = false ] ; then
- echo "Unknown location of the ZOO models"
- exit 170
+if [ "$MODELS_DIR" = false ] ; then
+ echo "Unknown location of the ZOO models"
+ exit 170
fi
-ONNX_MODELS_DIR=$MODELS_DIR/model_zoo/onnx_model_zoo
-MSFT_MODELS_DIR=$MODELS_DIR/model_zoo/MSFT
+ONNX_MODELS_DIR="$MODELS_DIR/model_zoo/onnx_model_zoo"
+MSFT_MODELS_DIR="$MODELS_DIR/model_zoo/MSFT"
-if [ $CLONE = true ] ; then
- if [ $CLEAN_DIR = true ] ; then
- rm -rf $ONNX_MODELS_DIR
- fi
- git clone https://github.com/onnx/models.git $ONNX_MODELS_DIR
+if [ "$CLONE" = true ] ; then
+ if [ "$CLEAN_DIR" = true ] ; then
+ rm -rf "$ONNX_MODELS_DIR"
+ fi
+ git clone https://github.com/onnx/models.git "$ONNX_MODELS_DIR"
fi
-mkdir -p $ONNX_MODELS_DIR
-cd $ONNX_MODELS_DIR
+mkdir -p "$ONNX_MODELS_DIR"
+cd "$ONNX_MODELS_DIR"
# remove already downloaded models
git clean -f -x -d
git checkout .
# pull models from the lfs repository
# onnx models are included in the tar.gz archives
git lfs pull --include="*" --exclude="*.onnx"
-find $ONNX_MODELS_DIR -name "*.onnx" | while read filename; do rm "$filename"; done;
+find "$ONNX_MODELS_DIR" -name "*.onnx" | while read filename; do rm "$filename"; done;
echo "extracting tar.gz archives..."
-find $ONNX_MODELS_DIR -name '*.tar.gz' -execdir sh -c 'BASEDIR=$(basename "{}" .tar.gz) && mkdir -p $BASEDIR' \; -execdir sh -c 'BASEDIR=$(basename "{}" .tar.gz) && tar -xzvf "{}" -C $BASEDIR' \;
+find "$ONNX_MODELS_DIR" -name '*.tar.gz' -execdir sh -c 'BASEDIR=$(basename "{}" .tar.gz) && mkdir -p $BASEDIR' \; -execdir sh -c 'BASEDIR=$(basename "{}" .tar.gz) && tar -xzvf "{}" -C $BASEDIR' \;
# fix yolo v4 model
-cd $ONNX_MODELS_DIR/vision/object_detection_segmentation/yolov4/model/yolov4/yolov4/test_data_set
+cd "$ONNX_MODELS_DIR/vision/object_detection_segmentation/yolov4/model/yolov4/yolov4/test_data_set"
mv input0.pb input_0.pb
mv input1.pb input_1.pb
mv input2.pb input_2.pb
mv output1.pb output_1.pb
mv output2.pb output_2.pb
# fix roberta model
-cd $ONNX_MODELS_DIR/text/machine_comprehension/roberta/model/roberta-sequence-classification-9/roberta-sequence-classification-9
+cd "$ONNX_MODELS_DIR/text/machine_comprehension/roberta/model/roberta-sequence-classification-9/roberta-sequence-classification-9"
mkdir test_data_set_0
mv *.pb test_data_set_0/
# Prepare MSFT models
-if [ $ENABLE_MSFT = true ] ; then
- if [ $CLEAN_DIR = true ] ; then
- rm -rf $MSFT_MODELS_DIR
+if [ "$ENABLE_MSFT" = true ] ; then
+ if [ "$CLEAN_DIR" = true ] ; then
+ rm -rf "$MSFT_MODELS_DIR"
fi
- mkdir -p $MSFT_MODELS_DIR
- wget -O $MSFT_MODELS_DIR/20191107.zip https://onnxruntimetestdata.blob.core.windows.net/models/20191107.zip
- unzip $MSFT_MODELS_DIR/20191107.zip -d $MSFT_MODELS_DIR/20191107 && rm $MSFT_MODELS_DIR/20191107.zip
+ mkdir -p "$MSFT_MODELS_DIR"
+ wget -O "$MSFT_MODELS_DIR/20191107.zip https://onnxruntimetestdata.blob.core.windows.net/models/20191107.zip"
+ unzip "$MSFT_MODELS_DIR/20191107.zip" -d "$MSFT_MODELS_DIR/20191107" && rm "$MSFT_MODELS_DIR/20191107.zip"
fi
printf "Error: setupvars.sh is not found\n"
fi
-if ! . $setupvars_path ; then
+if ! . "$setupvars_path" ; then
printf "Unable to run ./setupvars.sh. Please check its presence. ${run_again}"
exit 1
fi
pip_binary=pip3
system_ver=`cat /etc/lsb-release | grep -i "DISTRIB_RELEASE" | cut -d "=" -f2`
- if [ $system_ver = "16.04" ]; then
+ if [ "$system_ver" = "16.04" ]; then
sudo -E apt-get install -y libpng12-dev
else
sudo -E apt-get install -y libpng-dev
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
- $pip_binary install -r $ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in
+ $pip_binary install -r "$ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in"
else
- sudo -E $pip_binary install -r $ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in
+ sudo -E "$pip_binary" install -r "$ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in"
fi
downloader_dir="${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader"
OS_PATH=$(uname -m)
NUM_THREADS="-j2"
-if [ $OS_PATH == "x86_64" ]; then
+if [ "$OS_PATH" == "x86_64" ]; then
OS_PATH="intel64"
NUM_THREADS="-j8"
fi
build_dir="$HOME/inference_engine_samples_build"
binaries_dir="${build_dir}/${OS_PATH}/Release"
-if [ -e $build_dir/CMakeCache.txt ]; then
- rm -rf $build_dir/CMakeCache.txt
+if [ -e "$build_dir/CMakeCache.txt" ]; then
+ rm -rf "$build_dir/CMakeCache.txt"
fi
-mkdir -p $build_dir
-cd $build_dir
-cmake -DCMAKE_BUILD_TYPE=Release $samples_path
+mkdir -p "$build_dir"
+cd "$build_dir"
+cmake -DCMAKE_BUILD_TYPE=Release "$samples_path"
make $NUM_THREADS benchmark_app
printf "${dashes}"
printf "Run Inference Engine benchmark app\n\n"
-cd $binaries_dir
+cd "$binaries_dir"
-cp -f $ROOT_DIR/${model_name}.labels ${ir_dir}/
+cp -f "$ROOT_DIR/${model_name}.labels" "${ir_dir}/"
print_and_run ./benchmark_app -d "$target" -i "$target_image_path" -m "${ir_dir}/${model_name}.xml" -pc ${sampleoptions}
pip_binary=pip3
system_ver=`cat /etc/lsb-release | grep -i "DISTRIB_RELEASE" | cut -d "=" -f2`
- if [ $system_ver = "16.04" ]; then
+ if [ "$system_ver" = "16.04" ]; then
sudo -E apt-get install -y libpng12-dev
else
sudo -E apt-get install -y libpng-dev
fi
if [[ $DISTRO == "macos" ]]; then
- $pip_binary install -r $ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in
+ "$pip_binary" install -r "$ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in"
else
- sudo -E $pip_binary install -r $ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in
+ sudo -E "$pip_binary" install -r "$ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in"
fi
if [ -e "$ROOT_DIR/../../bin/setupvars.sh" ]; then
else
printf "Error: setupvars.sh is not found\n"
fi
-if ! . $setupvars_path ; then
+if ! . "$setupvars_path" ; then
printf "Unable to run ./setupvars.sh. Please check its presence. ${run_again}"
exit 1
fi
OS_PATH=$(uname -m)
NUM_THREADS="-j2"
-if [ $OS_PATH == "x86_64" ]; then
+if [ "$OS_PATH" == "x86_64" ]; then
OS_PATH="intel64"
NUM_THREADS="-j8"
fi
build_dir="$HOME/inference_engine_demos_build"
-if [ -e $build_dir/CMakeCache.txt ]; then
- rm -rf $build_dir/CMakeCache.txt
+if [ -e "$build_dir/CMakeCache.txt" ]; then
+ rm -rf "$build_dir/CMakeCache.txt"
fi
-mkdir -p $build_dir
-cd $build_dir
-cmake -DCMAKE_BUILD_TYPE=Release $demos_path
+mkdir -p "$build_dir"
+cd "$build_dir"
+cmake -DCMAKE_BUILD_TYPE=Release "$demos_path"
make $NUM_THREADS security_barrier_camera_demo
# Step 3. Run samples
printf "Run Inference Engine security_barrier_camera demo\n\n"
binaries_dir="${build_dir}/${OS_PATH}/Release"
-cd $binaries_dir
+cd "$binaries_dir"
print_and_run ./security_barrier_camera_demo -d "$target" -d_va "$target" -d_lpr "$target" -i "$target_image_path" "${model_args[@]}" ${sampleoptions}
printf "Error: setupvars.sh is not found\n"
fi
-if ! . $setupvars_path ; then
+if ! . "$setupvars_path" ; then
printf "Unable to run ./setupvars.sh. Please check its presence. ${run_again}"
exit 1
fi
pip_binary=pip3
system_ver=`cat /etc/lsb-release | grep -i "DISTRIB_RELEASE" | cut -d "=" -f2`
- if [ $system_ver = "16.04" ]; then
+ if [ "$system_ver" = "16.04" ]; then
sudo -E apt-get install -y libpng12-dev
else
sudo -E apt-get install -y libpng-dev
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
- $pip_binary install -r $ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in
+ "$pip_binary" install -r "$ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in"
else
- sudo -E $pip_binary install -r $ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in
+ sudo -E "$pip_binary" install -r "$ROOT_DIR/../open_model_zoo/tools/downloader/requirements.in"
fi
downloader_dir="${INTEL_OPENVINO_DIR}/deployment_tools/open_model_zoo/tools/downloader"
OS_PATH=$(uname -m)
NUM_THREADS="-j2"
-if [ $OS_PATH == "x86_64" ]; then
+if [ "$OS_PATH" == "x86_64" ]; then
OS_PATH="intel64"
NUM_THREADS="-j8"
fi
build_dir="$HOME/inference_engine_samples_build"
binaries_dir="${build_dir}/${OS_PATH}/Release"
-if [ -e $build_dir/CMakeCache.txt ]; then
- rm -rf $build_dir/CMakeCache.txt
+if [ -e "$build_dir/CMakeCache.txt" ]; then
+ rm -rf "$build_dir/CMakeCache.txt"
fi
-mkdir -p $build_dir
-cd $build_dir
-cmake -DCMAKE_BUILD_TYPE=Release $samples_path
+mkdir -p "$build_dir"
+cd "$build_dir"
+cmake -DCMAKE_BUILD_TYPE=Release "$samples_path"
make $NUM_THREADS classification_sample_async
printf "${dashes}"
printf "Run Inference Engine classification sample\n\n"
-cd $binaries_dir
+cd "$binaries_dir"
-cp -f $ROOT_DIR/${model_name}.labels ${ir_dir}/
+cp -f "$ROOT_DIR/${model_name}.labels" "${ir_dir}/"
print_and_run ./classification_sample_async -d "$target" -i "$target_image_path" -m "${ir_dir}/${model_name}.xml" ${sampleoptions}
+#!/bin/bash
+
# Copyright (c) 2018-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
"yum -y install rpmdevtools openssl openssl-devel bc numactl ocl-icd ocl-icd-devel")
for cmd in "${CMDS[@]}"; do
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
if [[ $? -ne 0 ]]; then
- echo ERROR: failed to run $cmd >&2
- echo Problem \(or disk space\)? >&2
- echo . Verify that you have enough disk space, and run the script again. >&2
+ echo "ERROR: failed to run $cmd" >&2
+ echo "Problem (or disk space)?" >&2
+ echo ". Verify that you have enough disk space, and run the script again." >&2
exit $EXIT_FAILURE
fi
done
"apt-get -y install libnuma1 ocl-icd-libopencl1")
for cmd in "${CMDS[@]}"; do
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
if [[ $? -ne 0 ]]; then
- echo ERROR: failed to run $cmd >&2
- echo Problem \(or disk space\)? >&2
+ echo "ERROR: failed to run $cmd" >&2
+ echo "Problem (or disk space)?" >&2
echo " sudo -E $0" >&2
- echo 2. Verify that you have enough disk space, and run the script again. >&2
+ echo "2. Verify that you have enough disk space, and run the script again." >&2
exit $EXIT_FAILURE
fi
done
# IGFX_RPM_FLAGS="--force" sudo -E ./install_NEO_OCL_driver.sh install
#
cmd="rpm $IGFX_RPM_FLAGS -ivh --nodeps --force $1"
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
}
_deploy_deb()
{
cmd="dpkg -i $1"
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
}
{
_deploy_rpm "intel*.rpm"
if [[ $? -ne 0 ]]; then
- echo ERROR: failed to install rpms $cmd error >&2
- echo Make sure you have enough disk space or fix the problem manually and try again. >&2
+ echo "ERROR: failed to install rpms $cmd error" >&2
+ echo "Make sure you have enough disk space or fix the problem manually and try again." >&2
exit $EXIT_FAILURE
fi
}
{
_deploy_deb "intel*.deb"
if [[ $? -ne 0 ]]; then
- echo ERROR: failed to install rpms $cmd error >&2
- echo Make sure you have enough disk space or fix the problem manually and try again. >&2
+ echo "ERROR: failed to install rpms $cmd error" >&2
+ echo "Make sure you have enough disk space or fix the problem manually and try again." >&2
exit $EXIT_FAILURE
fi
}
# exit from $SCRIPT_DIR/neo folder
cd -
# clean it up
- rm -rf $SCRIPT_DIR/neo
+ rm -rf "$SCRIPT_DIR/neo"
}
_uninstall_user_mode_centos()
"intel-igc-opencl")
for package in "${PACKAGES[@]}"; do
echo "rpm -qa | grep $package"
- found_package=$(rpm -qa | grep $package)
+ found_package=$(rpm -qa | grep "$package")
if [[ $? -eq 0 ]]; then
echo "Found installed user-mode driver, performing uninstall..."
cmd="rpm -e --nodeps ${found_package}"
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
if [[ $? -ne 0 ]]; then
echo "ERROR: failed to uninstall existing user-mode driver." >&2
echo "Please try again manually and run the script again." >&2
"intel-igc-opencl")
for package in "${PACKAGES[@]}"; do
- found_package=$(dpkg-query -W -f='${binary:Package}\n' ${package})
+ found_package=$(dpkg-query -W -f='${binary:Package}\n' "${package}")
if [[ $? -eq 0 ]]; then
echo "Found installed user-mode driver, performing uninstall..."
cmd="apt-get autoremove -y $package"
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
if [[ $? -ne 0 ]]; then
echo "ERROR: failed to uninstall existing user-mode driver." >&2
echo "Please try again manually and run the script again." >&2
else
cmd="dpkg-query -W -f='${binary:Package}\n' $pkg"
fi
- echo $cmd
- eval $cmd
+ echo "$cmd"
+ eval "$cmd"
}
_verify_checksum_centos()
{
- sha1sum -c $SCRIPT_DIR/neo_centos_ww41.sum
+ sha1sum -c "$SCRIPT_DIR/neo_centos_ww41.sum"
}
verify_checksum()
download_packages()
{
- mkdir -p $SCRIPT_DIR/neo
- cd $SCRIPT_DIR/neo
+ mkdir -p "$SCRIPT_DIR/neo"
+ cd "$SCRIPT_DIR/neo"
if [[ $DISTRO == "centos" ]]; then
_download_packages_centos
{
if [[ $EUID -ne 0 ]]; then
echo "ERROR: you must run this script as root." >&2
- echo "Please try again with "sudo -E $0", or as root." >&2
+ echo "Please try again with \"sudo -E $0\", or as root." >&2
exit $EXIT_FAILURE
fi
}
add_user_to_video_group()
{
- local real_user=$(logname 2>/dev/null || echo ${SUDO_USER:-${USER}})
+ local real_user=$(logname 2>/dev/null || echo "${SUDO_USER:-${USER}}")
echo
- echo Adding $real_user to the video group...
- usermod -a -G video $real_user
+ echo "Adding $real_user to the video group..."
+ usermod -a -G video "$real_user"
if [[ $? -ne 0 ]]; then
- echo WARNING: unable to add $real_user to the video group >&2
+ echo "WARNING: unable to add $real_user to the video group" >&2
fi
}
if [[ $DISTRO == centos ]]; then
CENTOS_MINOR=$(sed 's/CentOS Linux release 7\.\([[:digit:]]\+\).\+/\1/' /etc/centos-release)
if [[ $? -ne 0 ]]; then
- echo ERROR: failed to obtain CentOS version minor. >&2
- echo This script is supported only on CentOS 7 and above. >&2
+ echo "ERROR: failed to obtain CentOS version minor." >&2
+ echo "This script is supported only on CentOS 7 and above." >&2
exit $EXIT_FAILURE
fi
elif [[ $DISTRO == ubuntu ]]; then
MINIMUM_REQUIRED_PYTHON_VERSION="3.6"
MAX_SUPPORTED_PYTHON_VERSION=$([[ "$OSTYPE" == "darwin"* ]] && echo '3.7' || echo '3.8')
-if [[ ! -z "$python_version" && "$(printf '%s\n' "$python_version" "$MINIMUM_REQUIRED_PYTHON_VERSION" | sort -V | head -n 1)" != "$MINIMUM_REQUIRED_PYTHON_VERSION" ]]; then
+if [[ -n "$python_version" && "$(printf '%s\n' "$python_version" "$MINIMUM_REQUIRED_PYTHON_VERSION" | sort -V | head -n 1)" != "$MINIMUM_REQUIRED_PYTHON_VERSION" ]]; then
echo "[setupvars.sh] ERROR: Unsupported Python version. Please install one of Python 3.6-${MAX_SUPPORTED_PYTHON_VERSION} (64-bit) from https://www.python.org/downloads/"
return 1
fi
-if [ ! -z "$python_version" ]; then
+if [ -n "$python_version" ]; then
# add path to OpenCV API for Python 3.x
export PYTHONPATH="$INTEL_OPENVINO_DIR/python/python3:$PYTHONPATH"
pydir=$INTEL_OPENVINO_DIR/python/python$python_version