From 04cd60384f5fc8455bb7cf64416daa7b001754d1 Mon Sep 17 00:00:00 2001 From: James Conroy Date: Wed, 20 Apr 2022 17:16:50 +0100 Subject: IVGCVSW-6924 Fix shellcheck warnings * Fix shellcheck warnings, some have been suppressed using shellcheck ignore. Change-Id: Icae175a42bb348a58befb296949edca51713e977 Signed-off-by: James Conroy --- profiling/buildpipe.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'profiling/buildpipe.sh') diff --git a/profiling/buildpipe.sh b/profiling/buildpipe.sh index 611b7b96e0..cacee8728c 100755 --- a/profiling/buildpipe.sh +++ b/profiling/buildpipe.sh @@ -16,10 +16,9 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located fi done -RDIR="$( dirname "$SOURCE" )" DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" -CMD=$( basename $0 ) +CMD=$( basename "$0" ) usage() { echo "Usage: $CMD [options]" @@ -49,28 +48,32 @@ shift $((OPTIND - 1)) if [ $CLEAN == 1 ]; then echo "removing ${DIR}/build" - rm -rf ${DIR}/build + rm -rf "${DIR}"/build fi BUILD_DIR="build" -[ -d build ] || mkdir build +[ -d build ] || ( mkdir build || exit ) echo $WINDOWS if [ "$WINDOWS" -eq "1" ]; then echo "doing windows" - cd $BUILD_DIR + cd $BUILD_DIR || exit [ -d windows ] || mkdir windows BUILD_DIR=$BUILD_DIR/windows - cd $DIR + cd "$DIR" || exit fi # lower case TYPE in a posix compliant manner LC_TYPE=$(echo "$TYPE" | tr '[:upper:]' '[:lower:]') -if [ ${LC_TYPE} == "debug" ]; then - DEBUGDIR=($DIR/$BUILD_DIR/debug) - [ -d $DEBUGDIR ] || (cd ${BUILD_DIR} && mkdir debug && cd ..) +if [ "${LC_TYPE}" == "debug" ]; then + DEBUGDIR=("$DIR/$BUILD_DIR/debug") + # shellcheck disable=SC2128 + [ -d "$DEBUGDIR" ] || (cd ${BUILD_DIR} && ( mkdir debug || exit ) && cd ..) + # shellcheck disable=SC2128 BUILD_DIR=$DEBUGDIR else - RELEASEDIR=($DIR/$BUILD_DIR/release) - [ -d $RELEASEDIR ] || (cd ${BUILD_DIR} && mkdir release && cd ..) + RELEASEDIR=("$DIR/$BUILD_DIR/release") + # shellcheck disable=SC2128 + [ -d "$RELEASEDIR" ] || (cd "${BUILD_DIR}" && ( mkdir release || exit ) && cd ..) + # shellcheck disable=SC2128 BUILD_DIR=$RELEASEDIR fi @@ -84,8 +87,8 @@ if [ "$WINDOWS" -eq "1" ]; then CMARGS="$CMARGS \ -DCMAKE_TOOLCHAIN_FILE=${DIR}/toolchain-x86-ubuntu-mingw64.cmake" fi -MAKE=make +MAKE="make" -cd ${BUILD_DIR} +cd "${BUILD_DIR}" || exit pwd -( eval $CMAKE $CMARGS $DIR && eval ${MAKE} $MAKEFLAGS ) +( eval $CMAKE "$CMARGS" "$DIR" && eval ${MAKE} "$MAKEFLAGS" ) -- cgit v1.2.1