This is an automated email from the ASF dual-hosted git repository.

fgerlits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 8881a43  MINIFICPP-1524 Add shellcheck integration for linting shell 
scripts
8881a43 is described below

commit 8881a43a7a8d7406a99d21b0582302e2389842a2
Author: Gabor Gyimesi <[email protected]>
AuthorDate: Mon Mar 8 11:44:12 2021 +0100

    MINIFICPP-1524 Add shellcheck integration for linting shell scripts
    
    * Add shellcheck runner script
    * Fix shellcheck issues and warnings
    * Add error checks to run_shellcheck.sh
    * Add shellcheck target and integrate to CI
    * Add Apache license header
    * Add information of shellcheck to README.md
    * Added comment on disabling shellcheck
    
    Signed-off-by: Ferenc Gerlits <[email protected]>
    
    This closes #1026
---
 .github/workflows/ci.yml                        |   2 +
 CMakeLists.txt                                  |   3 +
 README.md                                       |   6 ++
 aptitude.sh                                     |   3 +-
 arch.sh                                         |   3 +-
 bin/minifi.sh                                   |  80 +++++++++----------
 bootstrap.sh                                    | 100 ++++++++++++------------
 bstrp_functions.sh                              |  89 ++++++++++-----------
 centos.sh                                       |  17 ++--
 darwin.sh                                       |  15 ++--
 debian.sh                                       |   3 +-
 deploy.sh                                       |   6 +-
 docker/DockerVerify.sh                          |  42 +++++-----
 extensions/civetweb/tests/resources/generate.sh |   8 +-
 fedora.sh                                       |   5 +-
 generateVersion.sh                              |   7 +-
 linux.sh                                        |   7 +-
 rheldistro.sh                                   |  13 ++-
 deploy.sh => run_shellcheck.sh                  |  12 +--
 suse.sh                                         |  20 +++--
 20 files changed, 213 insertions(+), 228 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f5ba73a..306ec15 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -175,6 +175,8 @@ jobs:
           echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts > /dev/null
       - id: build
         run: ./bootstrap.sh -e -t && cd build  && cmake -DUSE_SHARED_LIBS= 
-DCMAKE_BUILD_TYPE=Release -DENABLE_BUSTACHE=ON -DENABLE_SQL=ON 
-DENABLE_PCAP=ON -DSTRICT_GSL_CHECKS=AUDIT -DFAIL_ON_WARNINGS=ON .. && make -j4 
VERBOSE=1  && make test ARGS="--timeout 300 -j2 --output-on-failure"
+      - id: shellcheck
+        run: cd build && make shellcheck
   ubuntu_20_04_all_clang:
     name: "ubuntu-20.04-all-clang"
     runs-on: ubuntu-20.04
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9efff2..40df39e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -861,6 +861,9 @@ add_custom_target(linter
                        ${CMAKE_SOURCE_DIR}/encrypt-config/ --
                        ${CMAKE_SOURCE_DIR}/encrypt-config/
        DEPENDS ${extensions})
+
+add_custom_target(shellcheck
+       COMMAND ${CMAKE_SOURCE_DIR}/run_shellcheck.sh ${CMAKE_SOURCE_DIR})
 endif(NOT WIN32)
 
 # Custom target to download and run Apache Release Audit Tool (RAT)
diff --git a/README.md b/README.md
index 4d536ef..c49c1a6 100644
--- a/README.md
+++ b/README.md
@@ -590,6 +590,12 @@ We welcome all contributions to Apache MiNiFi. To make 
development easier, we've
 the linter for the Google Style guide. Google provides an Eclipse formatter 
for their style
 guide. It is located 
[here](https://github.com/google/styleguide/blob/gh-pages/eclipse-cpp-google-style.xml).
 New contributions are expected to follow the Google style guide when it is 
reasonable.
+
+Shell script files shall follow the guidelines and best practices defined by 
the [shellcheck](https://github.com/koalaman/shellcheck) analysis tool.
+New contributions are expected to pass the shellcheck analysis as part of the 
verification process.
+If a shellcheck requested change is unfeasable it shall be disabled on 
per-line basis and will be subjected to review.
+For more information on an issue please check the [shellcheck wiki 
page](https://github.com/koalaman/shellcheck/wiki).
+
 Additionally, all new files must include a copy of the Apache License Header.
 
 For more details on how to contribute please see our [Contribution 
Guide](CONTRIB.md)
diff --git a/aptitude.sh b/aptitude.sh
index b8693b1..7c8b515 100644
--- a/aptitude.sh
+++ b/aptitude.sh
@@ -18,8 +18,7 @@
 
 verify_enable_platform(){
     feature="$1"
-    feature_status=${!1}
-    verify_gcc_enable $feature
+    verify_gcc_enable "$feature"
 }
 add_os_flags() {
     CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND}"
diff --git a/arch.sh b/arch.sh
index f422bfd..e22d4c5 100644
--- a/arch.sh
+++ b/arch.sh
@@ -18,8 +18,7 @@
 
 verify_enable_platform(){
     feature="$1"
-    feature_status=${!1}
-    verify_gcc_enable $feature
+    verify_gcc_enable "${feature}"
 }
 add_os_flags() {
     CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND}"
diff --git a/bin/minifi.sh b/bin/minifi.sh
index d149507..c26f46f 100755
--- a/bin/minifi.sh
+++ b/bin/minifi.sh
@@ -17,11 +17,10 @@
 
 # Script structure inspired from Apache Karaf and other Apache projects with 
similar startup approaches
 
-SCRIPT_DIR=$(dirname "$0")
-SCRIPT_NAME=$(basename "$0")
 PROGNAME=$(basename "$0")
-SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
-export MINIFI_HOME="$(dirname ${SCRIPTPATH})"
+SCRIPTPATH="$( cd "$(dirname "$0")" || exit 1; pwd -P )"
+MINIFI_HOME="$(dirname "${SCRIPTPATH}")"
+export MINIFI_HOME
 bin_dir=${MINIFI_HOME}/bin
 minifi_executable=${bin_dir}/minifi
 pid_file=${bin_dir}/.minifi.pid
@@ -39,7 +38,6 @@ detectOS() {
     # OS specific support (must be 'true' or 'false').
     cygwin=false;
     aix=false;
-    os400=false;
     darwin=false;
     case "$(uname)" in
         CYGWIN*)
@@ -48,9 +46,6 @@ detectOS() {
         AIX*)
             aix=true
             ;;
-        OS400*)
-            os400=true
-            ;;
         Darwin)
             darwin=true
             ;;
@@ -72,27 +67,27 @@ get_pid() {
   # Default to a -1 for pid
   pid=-1
   # Check to see if we have a pid file
-  if [ -f ${pid_file} ]; then
-    pid=$(cat ${pid_file})
+  if [ -f "${pid_file}" ]; then
+    pid=$(cat "${pid_file}")
   fi
-  echo ${pid}
+  echo "${pid}"
 }
 
 # Performs a check to see if the provided pid is one that currently exists
 active_pid() {
   pid=${1}
-  if [ ${pid} -eq -1 ]; then
+  if [ "${pid}" -eq -1 ]; then
     echo 1
   else
-    kill -s 0 ${pid} > /dev/null 2>&1
+    kill -s 0 "${pid}" > /dev/null 2>&1
     echo $?
   fi
 }
 
 endnow() {
    echo "Killing MiNiFi..."
-   kill -9 ${saved_pid} > /dev/null 2>&1
-   
+   kill -9 "${saved_pid}" > /dev/null 2>&1
+
 }
 
 install() {
@@ -117,7 +112,7 @@ install() {
     fi
 
 # Create the init script, overwriting anything currently present
-cat <<SERVICEDESCRIPTOR > ${SVC_FILE}
+cat <<SERVICEDESCRIPTOR > "${SVC_FILE}"
 #!/bin/sh
 #
 #    Licensed to the Apache Software Foundation (ASF) under one or more
@@ -239,7 +234,7 @@ case "\$1" in
           exit 3;
         fi
         ;;
-     update) 
+     update)
         if [  -f \${bin_dir}/minifi.update ]; then
                 \${bin_dir}/minifi.sh stop
                 cp \${bin_dir}/minifi \${bin_dir}/minifi.bak
@@ -250,7 +245,7 @@ case "\$1" in
              if [ "\${saved_pid}" -gt 0 ]; then
                    if [ \$(active_pid \${saved_pid}) -ne 0 ]; then
                        cp \${bin_dir}/minifi.bak \${bin_dir}/minifi
-                               \${bin_dir}/minifi.sh start       
+                               \${bin_dir}/minifi.sh start
                    fi
                 fi
                fi
@@ -286,7 +281,7 @@ SERVICEDESCRIPTOR
     fi
 
     # Provide the user execute access on the file
-    chmod u+x ${SVC_FILE}
+    chmod u+x "${SVC_FILE}"
 
     rm -f "/etc/rc2.d/S65${SVC_NAME}"
     ln -s "/etc/init.d/${SVC_NAME}" "/etc/rc2.d/S65${SVC_NAME}" || { echo 
"Could not create link /etc/rc2.d/S65${SVC_NAME}"; exit 1; }
@@ -300,9 +295,9 @@ saved_pid=$(get_pid)
 case "$1" in
     start)
       if [ "${saved_pid}" -gt 0 ]; then
-        if [ $(active_pid ${saved_pid}) -ne 0 ]; then
+        if [ "$(active_pid "${saved_pid}")" -ne 0 ]; then
             echo "PID ${saved_pid} is stale, removing pid file at ${pid_file}";
-            if ! rm -f ${pid_file}; then
+            if ! rm -f "${pid_file}"; then
               echo "Could not remove ${pid_file}. File will need to be 
manually removed."
               exit 1;
             fi
@@ -313,30 +308,29 @@ case "$1" in
       fi
       ${minifi_executable} &
       pid=$!
-      echo ${pid} > ${pid_file}
-      echo Starting MiNiFi with PID ${pid} and pid file ${pid_file}
+      echo ${pid} > "${pid_file}"
+      echo "Starting MiNiFi with PID ${pid} and pid file ${pid_file}"
       ;;
     stop)
-      if [ $(active_pid ${saved_pid}) -ne 0 ]; then
+      if [ "$(active_pid "${saved_pid}")" -ne 0 ]; then
         echo "MiNiFi is not currently running."
       else
         echo "Stopping MiNiFi (PID: ${saved_pid})."
         # Send a SIGTERM to MiNiFi so that the handler begins shutdown.
-        kill -15 ${saved_pid} > /dev/null 2>&1
-        if [ $? -ne 0 ]; then
+        if ! kill -15 "${saved_pid}" > /dev/null 2>&1; then
           echo "Could not successfully send termination signal to MiNiFi (PID: 
${saved_pid})"
           exit 1;
         else
           # Clean up our pid file
-          rm -f ${pid_file}
+          rm -f "${pid_file}"
         fi
       fi
       ;;
     run)
       if [ "${saved_pid}" -gt 0 ]; then
-        if [ $(active_pid ${saved_pid}) -ne 0 ]; then
+        if [ "$(active_pid "${saved_pid}")" -ne 0 ]; then
             echo "PID ${saved_pid} is stale, removing pid file at ${pid_file}";
-            if ! rm -f ${pid_file}; then
+            if ! rm -f "${pid_file}"; then
               echo "Could not remove ${pid_file}. File will need to be 
manually removed."
               exit 1;
             fi
@@ -349,7 +343,7 @@ case "$1" in
       ;;
     status)
       if [ "${saved_pid}" -gt 0 ]; then
-        if [ $(active_pid ${saved_pid}) -ne 0 ]; then
+        if [ "$(active_pid "${saved_pid}")" -ne 0 ]; then
           # program is dead and pid file exists
           echo "Program is not currently running but stale pid file 
(${pid_file}) exists.";
           exit 1
@@ -364,39 +358,39 @@ case "$1" in
         exit 0;
       fi
       ;;
-    update) 
-        if [  -f ${bin_dir}/minifi.update ]; then
-                ${bin_dir}/minifi.sh stop
-                cp ${bin_dir}/minifi ${bin_dir}/minifi.bak
-             cp ${bin_dir}/minifi.update ${bin_dir}/minifi
+    update)
+        if [ -f "${bin_dir}"/minifi.update ]; then
+                "${bin_dir}"/minifi.sh stop
+                cp "${bin_dir}"/minifi "${bin_dir}"/minifi.bak
+             cp "${bin_dir}"/minifi.update "${bin_dir}"/minifi
              # ensure that the command is now running
-             ${bin_dir}/minifi.sh start
+             "${bin_dir}"/minifi.sh start
              saved_pid=$(get_pid)
              if [ "${saved_pid}" -gt 0 ]; then
-                   if [ $(active_pid ${saved_pid}) -ne 0 ]; then
-                       cp ${bin_dir}/minifi.bak ${bin_dir}/minifi
-                               ${bin_dir}/minifi.sh start       
+                   if [ "$(active_pid "${saved_pid}")" -ne 0 ]; then
+                       cp "${bin_dir}"/minifi.bak "${bin_dir}"/minifi
+                               "${bin_dir}"/minifi.sh start
                    fi
                 fi
                fi
         ;;
     restart)
       echo "Restarting MiNiFi. Hit CTRL+C at any time to forcibly terminate 
MiNiFi"
-      ${bin_dir}/minifi.sh stop
+      "${bin_dir}"/minifi.sh stop
       ticks=1
       printf "Waiting for process to terminate."
       trap endnow INT
       if [ "${saved_pid}" -gt 0 ]; then
-       while [ $(active_pid ${saved_pid}) -eq 0 ]; do
+       while [ "$(active_pid "${saved_pid}")" -eq 0 ]; do
                sleep 1
                ticks=$((ticks+1))
-               numticks=$(($ticks % 5))
+               numticks=$((ticks % 5))
                if [ "${numticks}"  -eq 0 ]; then
                        printf "."
                fi
         done
       fi
-      ${bin_dir}/minifi.sh start
+      "${bin_dir}"/minifi.sh start
       ;;
     install)
       install "$@"
diff --git a/bootstrap.sh b/bootstrap.sh
index 8a67035..2401996 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -22,31 +22,29 @@ CMAKE_GLOBAL_MIN_VERSION_MAJOR=3
 CMAKE_GLOBAL_MIN_VERSION_MINOR=7
 CMAKE_GLOBAL_MIN_VERSION_REVISION=0
 
-#RED='\033[0;41;30m'
-RED='\033[0;101m'
-NO_COLOR='\033[0;0;39m'
+export RED='\033[0;101m'
+export NO_COLOR='\033[0;0;39m'
+export TRUE="Enabled"
+export FALSE="Disabled"
+export DEPLOY="false"
+export NO_PROMPT="false"
+export FEATURES_SELECTED="false"
+export ALL_FEATURES_ENABLED=${FALSE}
+export BUILD_DIR="build"
+export BUILD_IDENTIFIER=""
+export OPTIONS=()
+export CMAKE_OPTIONS_ENABLED=()
+export CMAKE_OPTIONS_DISABLED=()
+export CMAKE_MIN_VERSION=()
+export INCOMPATIBLE_WITH=()
+export DEPLOY_LIMITS=()
+export DEPENDENCIES=()
+
 CORES=1
 BUILD="false"
 PACKAGE="false"
-BUILD_IDENTIFIER=""
-TRUE="Enabled"
-FALSE="Disabled"
-FEATURES_SELECTED="false"
-AUTO_REMOVE_EXTENSIONS="true"
-export NO_PROMPT="false"
-ALL_FEATURES_ENABLED=${FALSE}
-BUILD_DIR="build"
-
-DEPLOY="false"
-OPTIONS=()
-CMAKE_OPTIONS_ENABLED=()
-CMAKE_OPTIONS_DISABLED=()
-CMAKE_MIN_VERSION=()
-INCOMPATIBLE_WITH=()
-DEPLOY_LIMITS=()
 USER_DISABLE_TESTS="${FALSE}"
 USE_NINJA="false"
-DEPENDENCIES=()
 
 . "${script_directory}/bstrp_functions.sh"
 SKIP_CMAKE=${FALSE}
@@ -69,7 +67,7 @@ while :; do
       EnableAllFeatures
       ;;
     -c|--clear)
-      rm ${script_directory}/bt_state > /dev/null 2>&1
+      rm "${script_directory}/bt_state" > /dev/null 2>&1
       ;;
     -d|--deploy)
       NO_PROMPT="true"
@@ -109,11 +107,11 @@ while :; do
 done
 
 if [ -x "$(command -v hostname)" ]; then
-  HOSTNAME=`hostname`
-  PING_RESULT=`ping -c 1 ${HOSTNAME} 2>&1`
+  HOSTNAME=$(hostname)
+  PING_RESULT=$(ping -c 1 "${HOSTNAME}" 2>&1)
   if [[ "$PING_RESULT" = *unknown* ]]; then
     cntinu="N"
-    read -p "Cannot resolve your host name -- ${HOSTNAME} -- tests may fail, 
Continue?  [ Y/N ] " cntinu
+    read -r -p "Cannot resolve your host name -- ${HOSTNAME} -- tests may 
fail, Continue?  [ Y/N ] " cntinu
     if [ "$cntinu" = "Y" ] || [ "$cntinu" = "y" ]; then
       echo "Continuing..."
     else
@@ -124,7 +122,6 @@ fi
 
 
 if [ "$NO_PROMPT" = "true" ]; then
-  agree="N"
   echo "****************************************"
   echo "Welcome, this bootstrap script will update your system to install 
MiNiFi C++"
   echo "You have opted to skip prompts. "
@@ -147,11 +144,11 @@ elif [ -f /etc/debian_version ]; then
   OS=Debian
   VER=$(cat /etc/debian_version)
 elif [ -f /etc/SUSE-brand ]; then
-  VER=`cat /etc/SUSE-brand | tr '\n' ' ' | sed s/.*=\ //`
-  OS=`cat /etc/SUSE-brand | tr '\n' ' ' | sed s/VERSION.*//`
+  VER=$(tr '\n' ' ' < /etc/SUSE-brand | sed s/.*=\ //)
+  OS=$(tr '\n' ' ' < /etc/SUSE-brand | sed s/VERSION.*//)
 elif [ -f /etc/SUSE-release ]; then
-  VER=`cat /etc/SUSE-release | tr '\n' ' ' | sed s/.*=\ //`
-  OS=`cat /etc/SUSE-release | tr '\n' ' ' | sed s/VERSION.*//`
+  VER=$(tr '\n' ' ' < /etc/SUSE-release | sed s/.*=\ //)
+  OS=$(tr '\n' ' ' < /etc/SUSE-release | sed s/VERSION.*//)
 elif [ -f /etc/redhat-release ]; then
   # Older Red Hat, CentOS, etc.
   ...
@@ -159,9 +156,12 @@ else
   OS=$(uname -s)
   VER=$(uname -r)
 fi
-OS_MAJOR=`echo $VER | cut -d. -f1`
-OS_MINOR=`echo $VER | cut -d. -f2`
-OS_REVISION=`echo $EVR  | cut -d. -f3`
+OS_MAJOR=$(echo "$VER" | cut -d. -f1)
+export OS_MAJOR
+OS_MINOR=$(echo "$VER" | cut -d. -f2)
+export OS_MINOR
+OS_REVISION=$(echo "$EVR" | cut -d. -f3)
+export OS_REVISION
 
 ### Verify the compiler version
 
@@ -171,12 +171,15 @@ COMPILER_COMMAND=""
 
 if [ -x "$(command -v g++)" ]; then
   COMPILER_COMMAND="g++"
-  COMPILER_VERSION=`${COMPILER_COMMAND} -dumpversion`
+  COMPILER_VERSION=$(${COMPILER_COMMAND} -dumpversion)
 fi
 
-COMPILER_MAJOR=`echo $COMPILER_VERSION | cut -d. -f1`
-COMPILER_MINOR=`echo $COMPILER_VERSION | cut -d. -f2`
-COMPILER_REVISION=`echo $COMPILER_VERSION | cut -d. -f3`
+COMPILER_MAJOR=$(echo "$COMPILER_VERSION" | cut -d. -f1)
+export COMPILER_MAJOR
+COMPILER_MINOR=$(echo "$COMPILER_VERSION" | cut -d. -f2)
+export COMPILER_MINOR
+COMPILER_REVISION=$(echo "$COMPILER_VERSION" | cut -d. -f3)
+export COMPILER_REVISION
 
 
 if [[ "$OS" = "Darwin" ]]; then
@@ -349,32 +352,32 @@ if [ "${OVERRIDE_BUILD_IDENTIFIER}" != 
"${BUILD_IDENTIFIER}" ]; then
 fi
 
 if [ "$BUILD_DIR_D" != "build" ] && [ "$BUILD_DIR_D" != "$BUILD_DIR" ]; then
-  read -p "Build dir will override stored state, $BUILD_DIR. Press any key to 
continue " overwrite
+  read -r -p "Build dir will override stored state, $BUILD_DIR. Press any key 
to continue " overwrite
   BUILD_DIR=$BUILD_DIR_D
 
 fi
 
 if [ ! -d "${BUILD_DIR}" ]; then
-  mkdir ${BUILD_DIR}/
+  mkdir "${BUILD_DIR}/"
 else
 
   overwrite="Y"
   if [ "$NO_PROMPT" = "false" ] && [ "$FEATURES_SELECTED" = "false" ]; then
     echo "CMAKE Build dir (${BUILD_DIR}) exists, should we overwrite your 
build directory before we begin?"
-    read -p "If you have already bootstrapped, bootstrapping again isn't 
necessary to run make [ Y/N ] " overwrite
+    read -r -p "If you have already bootstrapped, bootstrapping again isn't 
necessary to run make [ Y/N ] " overwrite
   fi
   if [ "$overwrite" = "N" ] || [ "$overwrite" = "n" ]; then
     echo "Exiting ...."
     exit
   else
-    rm ${BUILD_DIR}/CMakeCache.txt > /dev/null 2>&1
+    rm "${BUILD_DIR}/CMakeCache.txt" > /dev/null 2>&1
   fi
 fi
 
 ## change to the directory
 
 
-pushd ${BUILD_DIR}
+pushd "${BUILD_DIR}" || exit 1
 
 while [ ! "$FEATURES_SELECTED" == "true" ]
 do
@@ -398,11 +401,11 @@ build_deps
 
 ## just in case
 
-CMAKE_VERSION=`${CMAKE_COMMAND} --version | head -n 1 | awk '{print $3}'`
+CMAKE_VERSION=$(${CMAKE_COMMAND} --version | head -n 1 | awk '{print $3}')
 
-CMAKE_MAJOR=`echo $CMAKE_VERSION | cut -d. -f1`
-CMAKE_MINOR=`echo $CMAKE_VERSION | cut -d. -f2`
-CMAKE_REVISION=`echo $CMAKE_VERSION | cut -d. -f3`
+CMAKE_MAJOR=$(echo "$CMAKE_VERSION" | cut -d. -f1)
+CMAKE_MINOR=$(echo "$CMAKE_VERSION" | cut -d. -f2)
+CMAKE_REVISION=$(echo "$CMAKE_VERSION" | cut -d. -f3)
 
 
 CMAKE_BUILD_COMMAND="${CMAKE_COMMAND} "
@@ -503,7 +506,7 @@ build_cmake_command(){
 
   continue_with_plan="Y"
   if [ ! "$NO_PROMPT" = "true" ]; then
-    read -p "Command will be '${CMAKE_BUILD_COMMAND}', run this? [ Y/N ] " 
continue_with_plan
+    read -r -p "Command will be '${CMAKE_BUILD_COMMAND}', run this? [ Y/N ] " 
continue_with_plan
   fi
   if [ "$continue_with_plan" = "N" ] || [ "$continue_with_plan" = "n" ]; then
     echo "Exiting ...."
@@ -522,7 +525,7 @@ else
 fi
 
 if [ "$BUILD" = "true" ]; then
-  make -j${CORES}
+  make -j"${CORES}"
 fi
 
 if [ "$PACKAGE" = "true" ]; then
@@ -530,5 +533,4 @@ if [ "$PACKAGE" = "true" ]; then
 fi
 
 
-popd
-
+popd || exit 2
diff --git a/bstrp_functions.sh b/bstrp_functions.sh
index 29c8cb5..d62e248 100755
--- a/bstrp_functions.sh
+++ b/bstrp_functions.sh
@@ -19,11 +19,11 @@
 script_directory="$(cd "$(dirname "$0")" && pwd)"
 
 get_cmake_version(){
-  CMAKE_VERSION=`${CMAKE_COMMAND} --version | head -n 1 | awk '{print $3}'`
+  CMAKE_VERSION=$(${CMAKE_COMMAND} --version | head -n 1 | awk '{print $3}')
 
-  CMAKE_MAJOR=`echo $CMAKE_VERSION | cut -d. -f1`
-  CMAKE_MINOR=`echo $CMAKE_VERSION | cut -d. -f2`
-  CMAKE_REVISION=`echo $CMAKE_VERSION | cut -d. -f3`
+  CMAKE_MAJOR=$(echo "$CMAKE_VERSION" | cut -d. -f1)
+  CMAKE_MINOR=$(echo "$CMAKE_VERSION" | cut -d. -f2)
+  CMAKE_REVISION=$(echo "$CMAKE_VERSION" | cut -d. -f3)
 }
 
 add_option(){
@@ -46,11 +46,11 @@ add_disabled_option(){
   eval "$1=$2"
   OPTIONS+=("$1")
   CMAKE_OPTIONS_ENABLED+=("$1:$3")
-  if [ ! -z "$4" ]; then
+  if [ -n "$4" ]; then
     CMAKE_MIN_VERSION+=("$1:$4")
   fi
 
-  if [ ! -z "$5" ]; then
+  if [ -n "$5" ]; then
     if [ "$5" = "true" ]; then
       DEPLOY_LIMITS+=("$1")
     fi
@@ -62,9 +62,9 @@ add_multi_option(){
   ARRAY=()
   eval "export $1_OPTIONS=()"
   for i in "${@:3}"; do
-    ARRAY+=($i)
+    ARRAY+=("$i")
   done
-  for i in ${!ARRAY[@]}; do
+  for i in "${!ARRAY[@]}"; do
     eval "$1_OPTIONS[$i]=${ARRAY[$i]}"
        done
 }
@@ -75,30 +75,28 @@ set_incompatible_with(){
 }
 
 print_multi_option_status(){
-  feature="$1"
   feature_status=${!1}
   declare -a VAR_OPTS=()
 
-  declare VAR_OPTS=$1_OPTIONS[@]
-  VAR_OPTS=$1_OPTIONS[@]
+  declare VAR_OPTS=("$1_OPTIONS[@]")
+  VAR_OPTS=("$1_OPTIONS[@]")
 
   for option in "${!VAR_OPTS}" ; do
     if [ "${option}" = "$feature_status" ]; then
-       printf "${RED}"
+      printf "%b%s%b " "${RED}" "${option}" "${NO_COLOR}"
+    else
+      printf "%s " "${option}"
     fi
-    printf "${option}"
-    printf "${NO_COLOR} "
   done
 }
 
 ToggleMultiOption(){
-  feature="$1"
   feature_status=${!1}
   declare -a VAR_OPTS=()
 
-  declare VAR_OPTS=$1_OPTIONS[@]
+  declare VAR_OPTS=("$1_OPTIONS[@]")
   #echo -e "${RED}${feature_status}${NO_COLOR} (${VAR_OPTS_VAL})"
-  VAR_OPTS=$1_OPTIONS[@]
+  VAR_OPTS=("$1_OPTIONS[@]")
   invariant=""
   first=""
   # the alternative is to loop through an array but since we're an indirected
@@ -134,20 +132,20 @@ EnableAllFeatures(){
   for option in "${OPTIONS[@]}" ; do
     feature_status=${!option}
     if [ "$feature_status" = "${FALSE}" ]; then
-      ToggleFeature $option
+      ToggleFeature "${option}"
     fi
     #  eval "$option=${TRUE}"
   done
 }
 
 pause(){
-  read -p "Press [Enter] key to continue..." fackEnterKey
+  read -r -p "Press [Enter] key to continue..."
 }
 
 
 load_state(){
-  if [ -f ${script_directory}/bt_state ]; then
-    . ${script_directory}/bt_state
+  if [ -f "${script_directory}/bt_state" ]; then
+    . "${script_directory}/bt_state"
     for option in "${OPTIONS[@]}" ; do
       option_value="${!option}"
       if [ "${option_value}" = "${FALSE}" ]; then
@@ -159,11 +157,11 @@ load_state(){
 
 echo_state_variable(){
   VARIABLE_VALUE=${!1}
-  echo "$1=\"${VARIABLE_VALUE}\"" >> ${script_directory}/bt_state
+  echo "$1=\"${VARIABLE_VALUE}\"" >> "${script_directory}/bt_state"
 }
 
 save_state(){
-  echo "VERSION=1" > ${script_directory}/bt_state
+  echo "VERSION=1" > "${script_directory}/bt_state"
   echo_state_variable BUILD_IDENTIFIER
   echo_state_variable BUILD_DIR
   echo_state_variable TESTS_ENABLED
@@ -172,7 +170,7 @@ save_state(){
   echo_state_variable ASAN_ENABLED
   echo_state_variable FAIL_ON_WARNINGS
   for option in "${OPTIONS[@]}" ; do
-    echo_state_variable $option
+    echo_state_variable "${option}"
   done
 }
 
@@ -182,7 +180,7 @@ check_compatibility(){
     if [ "$OPT" = "$1" ]; then
       OTHER_FEATURE=${option#*:}
       OTHER_FEATURE_VALUE=${!OTHER_FEATURE}
-      if [ $OTHER_FEATURE_VALUE = "Enabled" ]; then
+      if [ "${OTHER_FEATURE_VALUE}" = "Enabled" ]; then
         echo "false"
         return
       fi
@@ -192,9 +190,9 @@ check_compatibility(){
 }
 
 verify_enable(){
-  COMPATIBLE=$(check_compatibility $1)
+  COMPATIBLE=$(check_compatibility "$1")
   if [ "$COMPATIBLE" = "true" ]; then
-    verify_enable_platform $1
+    verify_enable_platform "$1"
   else
     echo "false"
   fi
@@ -213,16 +211,16 @@ can_deploy(){
 ToggleFeature(){
   VARIABLE_VALUE=${!1}
   ALL_FEATURES_ENABLED="Disabled"
-  if [ $VARIABLE_VALUE = "Enabled" ]; then
+  if [ "${VARIABLE_VALUE}" = "Enabled" ]; then
     eval "$1=${FALSE}"
   else
     for option in "${CMAKE_MIN_VERSION[@]}" ; do
       OPT=${option%%:*}
       if [ "$OPT" = "$1" ]; then
         NEEDED_VER=${option#*:}
-        NEEDED_MAJOR=`echo $NEEDED_VER | cut -d. -f1`
-        NEEDED_MINOR=`echo $NEEDED_VER | cut -d. -f2`
-        NEEDED_REVISION=`echo $NEEDED_VERSION | cut -d. -f3`
+        NEEDED_MAJOR=$(echo "$NEEDED_VER" | cut -d. -f1)
+        NEEDED_MINOR=$(echo "$NEEDED_VER" | cut -d. -f2)
+        NEEDED_REVISION=$(echo "$NEEDED_VERSION" | cut -d. -f3)
         if (( NEEDED_MAJOR > CMAKE_MAJOR )); then
           return 1
         fi
@@ -236,8 +234,8 @@ ToggleFeature(){
         fi
       fi
     done
-    CAN_ENABLE=$(verify_enable $1)
-    CAN_DEPLOY=$(can_deploy $1)
+    CAN_ENABLE=$(verify_enable "$1")
+    CAN_DEPLOY=$(can_deploy "$1")
     if [ "$CAN_ENABLE" = "true" ]; then
       if [[ "$DEPLOY" = "true" &&  "$CAN_DEPLOY" = "true" ]] || [[ "$DEPLOY" = 
"false" ]]; then
         eval "$1=${TRUE}"
@@ -248,7 +246,6 @@ ToggleFeature(){
 
 
 print_feature_status(){
-  feature="$1"
   feature_status=${!1}
   if [ "$feature_status" = "Enabled" ]; then
     echo "Enabled"
@@ -257,9 +254,9 @@ print_feature_status(){
       OPT=${option%%:*}
       if [ "${OPT}" = "$1" ]; then
         NEEDED_VER=${option#*:}
-        NEEDED_MAJOR=`echo $NEEDED_VER | cut -d. -f1`
-        NEEDED_MINOR=`echo $NEEDED_VER | cut -d. -f2`
-        NEEDED_REVISION=`echo $NEEDED_VERSION | cut -d. -f3`
+        NEEDED_MAJOR=$(echo "$NEEDED_VER" | cut -d. -f1)
+        NEEDED_MINOR=$(echo "$NEEDED_VER" | cut -d. -f2)
+        NEEDED_REVISION=$(echo "$NEEDED_VERSION" | cut -d. -f3)
         if (( NEEDED_MAJOR > CMAKE_MAJOR )); then
           echo -e "${RED}Disabled*${NO_COLOR}"
           return 1
@@ -276,7 +273,7 @@ print_feature_status(){
         fi
       fi
     done
-    CAN_ENABLE=$(verify_enable $1)
+    CAN_ENABLE=$(verify_enable "$1")
     if [ "$CAN_ENABLE" = "true" ]; then
       echo -e "${RED}Disabled${NO_COLOR}"
     else
@@ -304,8 +301,8 @@ show_main_menu() {
 
 read_main_menu_options(){
   local choice
-  read -p "Enter choice [ A-C ] " choice
-  choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]')
+  read -r -p "Enter choice [ A-C ] " choice
+  choice=$(echo "${choice}" | tr '[:upper:]' '[:lower:]')
   case $choice in
     a) MENU="features" ;;
     b) MENU="advanced" ;;
@@ -328,8 +325,8 @@ show_advanced_features_menu() {
 
 read_advanced_menu_options(){
   local choice
-  read -p "Enter choice [ A-C ] " choice
-  choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]')
+  read -r -p "Enter choice [ A-C ] " choice
+  choice=$(echo "${choice}" | tr '[:upper:]' '[:lower:]')
   case $choice in
     a) ToggleFeature PORTABLE_BUILD ;;
     b) ToggleFeature DEBUG_SYMBOLS ;;
@@ -389,8 +386,8 @@ show_supported_features() {
 
 read_feature_options(){
   local choice
-  read -p "Enter choice [ A - X or 1-7 ] " choice
-  choice=$(echo ${choice} | tr '[:upper:]' '[:lower:]')
+  read -r -p "Enter choice [ A - X or 1-7 ] " choice
+  choice=$(echo "${choice}" | tr '[:upper:]' '[:lower:]')
   case $choice in
     a) ToggleFeature ROCKSDB_ENABLED ;;
     b) ToggleFeature HTTP_CURL_ENABLED ;;
@@ -430,9 +427,9 @@ read_feature_options(){
     5) ToggleMultiOption BUILD_PROFILE;;
     6) ToggleFeature ASAN_ENABLED;;
     7) ToggleFeature FAIL_ON_WARNINGS;;
-    p) FEATURES_SELECTED="true" ;;
+    p) export FEATURES_SELECTED="true" ;;
     r) if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then
-        MENU="main"
+        export MENU="main"
       fi
       ;;
     q) exit 0;;
diff --git a/centos.sh b/centos.sh
index 1430164..7eef91e 100644
--- a/centos.sh
+++ b/centos.sh
@@ -18,7 +18,6 @@
 
 verify_enable_platform() {
     feature="$1"
-    feature_status=${!1}
     if [ "$OS_MAJOR" = "6" ]; then
         if [ "$feature" = "GPS_ENABLED" ]; then
             echo "false"
@@ -27,13 +26,13 @@ verify_enable_platform() {
         elif [ "$feature" = "TENSORFLOW_ENABLED" ]; then
             echo "false"
         else
-            verify_gcc_enable $feature
+            verify_gcc_enable "$feature"
         fi
     else
         if [ "$feature" = "USB_ENABLED" ]; then
             echo "false"
         else
-            verify_gcc_enable $feature
+            verify_gcc_enable "$feature"
         fi
     fi
 }
@@ -47,8 +46,8 @@ install_bison() {
     if [ "$OS_MAJOR" = "6" ]; then
         BISON_INSTALLED="false"
         if [ -x "$(command -v bison)" ]; then
-            BISON_VERSION=`bison --version | head -n 1 | awk '{print $4}'`
-            BISON_MAJOR=`echo $BISON_VERSION | cut -d. -f1`
+            BISON_VERSION=$(bison --version | head -n 1 | awk '{print $4}')
+            BISON_MAJOR=$(echo "$BISON_VERSION" | cut -d. -f1)
             if (( BISON_MAJOR >= 3 )); then
                 BISON_INSTALLED="true"
             fi
@@ -56,11 +55,11 @@ install_bison() {
         if [ "$BISON_INSTALLED" = "false" ]; then
             wget https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz
             tar xvf bison-3.0.4.tar.xz
-            pushd bison-3.0.4
+            pushd bison-3.0.4 || exit 1
             ./configure
             make
             make install
-            popd
+            popd || exit 2
         fi
 
     else
@@ -73,13 +72,13 @@ install_libusb() {
         sudo yum -y install libtool libudev-devel patch
         #      git clone --branch v1.0.18 https://github.com/libusb/libusb.git
         git clone https://github.com/libusb/libusb.git
-        pushd libusb
+        pushd libusb || exit 3
         git checkout v1.0.18
         ./bootstrap.sh
         ./configure
         make
         sudo make install
-        popd
+        popd || exit 4
         rm -rf libusb
     else
         INSTALLED+=("libusb-devel")
diff --git a/darwin.sh b/darwin.sh
index 0e6bd81..eb5a5c4 100644
--- a/darwin.sh
+++ b/darwin.sh
@@ -18,14 +18,11 @@
 
 verify_enable_platform() {
     feature="$1"
-    feature_status=${!1}
     if [ "$feature" = "BUSTACHE_ENABLED" ]; then
         BUSTACHE_MAX="9"
         ## we should check the xcode version
-        CLANG_VERSION=`clang --version | head -n 1 | awk '{print $4}'`
-        CLANG_MAJOR=`echo $CLANG_VERSION | cut -d. -f1`
-        CLANG_MINOR=`echo $CLANG_VERSION | cut -d. -f2`
-        CLANG_REVISION=`echo $CLANG_VERSION | cut -d. -f3`
+        CLANG_VERSION=$(clang --version | head -n 1 | awk '{print $4}')
+        CLANG_MAJOR=$(echo "$CLANG_VERSION" | cut -d. -f1)
         if [ "$CLANG_MAJOR" -ge "$BUSTACHE_MAX" ]; then
             echo "false"
         else
@@ -43,8 +40,8 @@ add_os_flags(){
 install_bison() {
     BISON_INSTALLED="false"
     if [ -x "$(command -v bison)" ]; then
-        BISON_VERSION=`bison --version | head -n 1 | awk '{print $4}'`
-        BISON_MAJOR=`echo $BISON_VERSION | cut -d. -f1`
+        BISON_VERSION=$(bison --version | head -n 1 | awk '{print $4}')
+        BISON_MAJOR=$(echo "$BISON_VERSION" | cut -d. -f1)
         if (( BISON_MAJOR >= 3 )); then
             BISON_INSTALLED="true"
         fi
@@ -52,11 +49,11 @@ install_bison() {
     if [ "$BISON_INSTALLED" = "false" ]; then
         wget https://ftp.gnu.org/gnu/bison/bison-3.0.5.tar.xz
         tar xvf bison-3.0.5.tar.xz
-        pushd bison-3.0.5
+        pushd bison-3.0.5 || exit 1
         ./configure
         make
         sudo make install
-        popd
+        popd || exit 2
     fi
 
 }
diff --git a/debian.sh b/debian.sh
index 6c58921..0df18e7 100644
--- a/debian.sh
+++ b/debian.sh
@@ -18,8 +18,7 @@
 
 verify_enable_platform(){
   feature="$1"
-  feature_status=${!1}
-  verify_gcc_enable $feature
+  verify_gcc_enable "$feature"
 }
 add_os_flags() {
   CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND}"
diff --git a/deploy.sh b/deploy.sh
index c28c63c..2eeadb5 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -21,8 +21,8 @@ build_identifier=$1
 
 echo "${build_identifier}" > build_identifier
 
-./bootstrap.sh -d -p --build_identifier=${build_identifier}
+./bootstrap.sh -d -p --build_identifier="${build_identifier}"
 
-pushd build
+pushd build || exit 1
 ./controller/minificontroller --manifest >> build_output
-popd
+popd || exit 2
diff --git a/docker/DockerVerify.sh b/docker/DockerVerify.sh
index 288042f..4ccc98f 100755
--- a/docker/DockerVerify.sh
+++ b/docker/DockerVerify.sh
@@ -72,27 +72,27 @@ export PATH
 PYTHONPATH="${PYTHONPATH}:${docker_dir}/test/integration"
 export PYTHONPATH
 
-BEHAVE_OPTS="-f pretty --logging-level INFO --logging-clear-handlers"
+BEHAVE_OPTS=(-f pretty --logging-level INFO --logging-clear-handlers)
 
 cd "${docker_dir}/test/integration"
 exec
-  behave $BEHAVE_OPTS "features/file_system_operations.feature" -n "Get and 
put operations run in a simple flow" &&
-  behave $BEHAVE_OPTS "features/file_system_operations.feature" -n "PutFile 
does not overwrite a file that already exists" &&
-  behave $BEHAVE_OPTS "features/s2s.feature" -n "A MiNiFi instance produces 
and transfers data to a NiFi instance via s2s" &&
-  behave $BEHAVE_OPTS "features/s2s.feature" -n "Zero length files are 
transfered between via s2s if the \"drop empty\" connection property is false" 
&&
-  behave $BEHAVE_OPTS "features/s2s.feature" -n "Zero length files are not 
transfered between via s2s if the \"drop empty\" connection property is true" &&
-  behave $BEHAVE_OPTS "features/http.feature" -n "A MiNiFi instance transfers 
data to another MiNiFi instance" &&
-  behave $BEHAVE_OPTS "features/http.feature" -n "A MiNiFi instance sends data 
through a HTTP proxy and another one listens" &&
-  behave $BEHAVE_OPTS "features/http.feature" -n "A MiNiFi instance and 
transfers hashed data to another MiNiFi instance" &&
-  behave $BEHAVE_OPTS "features/kafka.feature" -n "A MiNiFi instance transfers 
data to a kafka broker" &&
-  behave $BEHAVE_OPTS "features/kafka.feature" -n "PublishKafka sends 
flowfiles to failure when the broker is not available" &&
-  behave $BEHAVE_OPTS "features/kafka.feature" -n "PublishKafka sends can use 
SSL connect" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance transfers 
encoded data to s3" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance transfers 
encoded data through a http proxy to s3" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance can remove 
s3 bucket objects" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "Deletion of a s3 object 
through a proxy-server succeeds" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance can download 
s3 bucket objects directly" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance can download 
s3 bucket objects via a http-proxy" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance can list an 
S3 bucket directly" &&
-  behave $BEHAVE_OPTS "features/s3.feature" -n "A MiNiFi instance can list an 
S3 bucket objects via a http-proxy" &&
-  behave $BEHAVE_OPTS "features/azure_storage.feature" -n "A MiNiFi instance 
can upload data to Azure blob storage"
+  behave "${BEHAVE_OPTS[@]}" "features/file_system_operations.feature" -n "Get 
and put operations run in a simple flow" &&
+  behave "${BEHAVE_OPTS[@]}" "features/file_system_operations.feature" -n 
"PutFile does not overwrite a file that already exists" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s2s.feature" -n "A MiNiFi instance 
produces and transfers data to a NiFi instance via s2s" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s2s.feature" -n "Zero length files are 
transfered between via s2s if the \"drop empty\" connection property is false" 
&&
+  behave "${BEHAVE_OPTS[@]}" "features/s2s.feature" -n "Zero length files are 
not transfered between via s2s if the \"drop empty\" connection property is 
true" &&
+  behave "${BEHAVE_OPTS[@]}" "features/http.feature" -n "A MiNiFi instance 
transfers data to another MiNiFi instance" &&
+  behave "${BEHAVE_OPTS[@]}" "features/http.feature" -n "A MiNiFi instance 
sends data through a HTTP proxy and another one listens" &&
+  behave "${BEHAVE_OPTS[@]}" "features/http.feature" -n "A MiNiFi instance and 
transfers hashed data to another MiNiFi instance" &&
+  behave "${BEHAVE_OPTS[@]}" "features/kafka.feature" -n "A MiNiFi instance 
transfers data to a kafka broker" &&
+  behave "${BEHAVE_OPTS[@]}" "features/kafka.feature" -n "PublishKafka sends 
flowfiles to failure when the broker is not available" &&
+  behave "${BEHAVE_OPTS[@]}" "features/kafka.feature" -n "PublishKafka sends 
can use SSL connect" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance 
transfers encoded data to s3" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance 
transfers encoded data through a http proxy to s3" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance can 
remove s3 bucket objects" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "Deletion of a s3 object 
through a proxy-server succeeds" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance can 
download s3 bucket objects directly" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance can 
download s3 bucket objects via a http-proxy" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance can 
list an S3 bucket directly" &&
+  behave "${BEHAVE_OPTS[@]}" "features/s3.feature" -n "A MiNiFi instance can 
list an S3 bucket objects via a http-proxy" &&
+  behave "${BEHAVE_OPTS[@]}" "features/azure_storage.feature" -n "A MiNiFi 
instance can upload data to Azure blob storage"
diff --git a/extensions/civetweb/tests/resources/generate.sh 
b/extensions/civetweb/tests/resources/generate.sh
index 8daab7f..7246681 100755
--- a/extensions/civetweb/tests/resources/generate.sh
+++ b/extensions/civetweb/tests/resources/generate.sh
@@ -1,8 +1,8 @@
 #!/bin/sh
 
-function create_ca {
+create_ca() {
   if [ $# -ne 2 ]; then
-    exit -1
+    exit 1
   fi
   name=$1
   cn=$2
@@ -11,9 +11,9 @@ function create_ca {
   openssl req -x509 -new -nodes -key "$name.key" -sha256 -days 10950 -subj 
"/C=US/ST=CA/O=Example, Inc./CN=$cn" -out "$name.crt"
 }
 
-function create_cert {
+create_cert() {
   if [ $# -ne 3 ]; then
-    exit -1
+    exit 1
   fi
   ca=$1
   name=$2
diff --git a/fedora.sh b/fedora.sh
index ca57258..d80ed09 100644
--- a/fedora.sh
+++ b/fedora.sh
@@ -18,8 +18,7 @@
 
 verify_enable_platform(){
     feature="$1"
-    feature_status=${!1}
-    verify_gcc_enable $feature
+    verify_gcc_enable "$feature"
 }
 add_os_flags() {
     :
@@ -49,7 +48,7 @@ build_deps(){
                 VALUE=${cmake_opt#*:}
                 if [ "$KEY" = "$option" ]; then
                     FOUND_VALUE="$VALUE"
-                    echo $FOUND_VALUE
+                    echo "$FOUND_VALUE"
                     if [ "$FOUND_VALUE" = "libpcap" ]; then
                         INSTALLED+=("libpcap-devel")
                     elif [ "$FOUND_VALUE" = "libusb" ]; then
diff --git a/generateVersion.sh b/generateVersion.sh
index 2e00930..194d3d0 100755
--- a/generateVersion.sh
+++ b/generateVersion.sh
@@ -23,11 +23,10 @@ flags=$6
 extensions=$7
 buildident=$8
 
-date=`date +%s`
+date=$(date +%s)
 
-if [ -d ${src_dir}/.git ]; then
-  buildrev=`git log -1 --pretty=format:"%H"`
-  hostname=`hostname`
+if [ -d "${src_dir}"/.git ]; then
+  buildrev=$(git log -1 --pretty=format:"%H")
 else
   buildrev="Unknown"
 fi
diff --git a/linux.sh b/linux.sh
index 90e0ba6..167789b 100644
--- a/linux.sh
+++ b/linux.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
 # distributed with this work for additional information
@@ -14,13 +15,11 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-#!/bin/bash
 verify_gcc_enable(){
   feature="$1"
-  feature_status=${!1}
-  if [ "$feature" = "BUSTACHE_ENABLED" ]; then 
+  if [ "$feature" = "BUSTACHE_ENABLED" ]; then
     if (( COMPILER_MAJOR == 6 && COMPILER_MINOR >= 3 && COMPILER_REVISION >= 1 
 )); then
-      echo "true"          
+      echo "true"
     elif (( COMPILER_MAJOR > 6 )); then
       echo "true"
     else
diff --git a/rheldistro.sh b/rheldistro.sh
index 5999b41..709f3a5 100644
--- a/rheldistro.sh
+++ b/rheldistro.sh
@@ -18,20 +18,19 @@
 
 verify_enable_platform() {
   feature="$1"
-  feature_status=${!1}
   if [ "$OS_MAJOR" = "6" ]; then
     if [ "$feature" = "GPS_ENABLED" ]; then
       echo "false"
     elif [ "$feature" = "USB_ENABLED" ]; then
       echo "false"
     else
-      verify_gcc_enable $feature
+      verify_gcc_enable "$feature"
     fi
   else
     if [ "$feature" = "USB_ENABLED" ]; then
       echo "false"
     else
-      verify_gcc_enable $feature
+      verify_gcc_enable "$feature"
     fi
   fi
 }
@@ -45,8 +44,8 @@ install_bison() {
   if [ "$OS_MAJOR" = "6" ]; then
     BISON_INSTALLED="false"
     if [ -x "$(command -v bison)" ]; then
-      BISON_VERSION=`bison --version | head -n 1 | awk '{print $4}'`
-      BISON_MAJOR=`echo $BISON_VERSION | cut -d. -f1`
+      BISON_VERSION=$(bison --version | head -n 1 | awk '{print $4}')
+      BISON_MAJOR=$(echo "$BISON_VERSION" | cut -d. -f1)
       if (( BISON_MAJOR >= 3 )); then
         BISON_INSTALLED="true"
       fi
@@ -54,11 +53,11 @@ install_bison() {
     if [ "$BISON_INSTALLED" = "false" ]; then
       wget https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz
       tar xvf bison-3.0.4.tar.xz
-      pushd bison-3.0.4
+      pushd bison-3.0.4 || exit 1
       ./configure
       make
       make install
-      popd
+      popd || exit 2
     fi
 
   else
diff --git a/deploy.sh b/run_shellcheck.sh
similarity index 79%
copy from deploy.sh
copy to run_shellcheck.sh
index c28c63c..6f1430a 100755
--- a/deploy.sh
+++ b/run_shellcheck.sh
@@ -16,13 +16,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+set -euo pipefail
 
-build_identifier=$1
-
-echo "${build_identifier}" > build_identifier
-
-./bootstrap.sh -d -p --build_identifier=${build_identifier}
-
-pushd build
-./controller/minificontroller --manifest >> build_output
-popd
+directory=${1:-.}
+find "${directory}" -type d \( -path "*thirdparty*" -o -path "*build*" \) 
-prune -false -o -type f -name "*.sh" | xargs shellcheck --exclude=SC1090,SC1091
diff --git a/suse.sh b/suse.sh
index f72474c..9e4908d 100644
--- a/suse.sh
+++ b/suse.sh
@@ -18,20 +18,19 @@
 
 verify_enable_platform() {
   feature="$1"
-  feature_status=${!1}
   if [ "$OS_MAJOR" = "6" ]; then
-    if [ "$feature" = "GPS_ENABLED" ]; then
+    if [ "${feature}" = "GPS_ENABLED" ]; then
       echo "false"
-    elif [ "$feature" = "USB_ENABLED" ]; then
+    elif [ "${feature}" = "USB_ENABLED" ]; then
       echo "false"
     else
-      verify_gcc_enable $feature
+      verify_gcc_enable "${feature}"
     fi
   else
-    if [ "$feature" = "USB_ENABLED" ]; then
+    if [ "${feature}" = "USB_ENABLED" ]; then
       echo "false"
     else
-      verify_gcc_enable $feature
+      verify_gcc_enable "${feature}"
     fi
   fi
 }
@@ -42,8 +41,8 @@ add_os_flags() {
 install_bison() {
   BISON_INSTALLED="false"
   if [ -x "$(command -v bison)" ]; then
-    BISON_VERSION=`bison --version | head -n 1 | awk '{print $4}'`
-    BISON_MAJOR=`echo $BISON_VERSION | cut -d. -f1`
+    BISON_VERSION=$(bison --version | head -n 1 | awk '{print $4}')
+    BISON_MAJOR=$(echo "${BISON_VERSION}" | cut -d. -f1)
     if (( BISON_MAJOR >= 3 )); then
       BISON_INSTALLED="true"
     fi
@@ -54,13 +53,12 @@ install_bison() {
     ${INSTALL_BASE}
     wget https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz
     tar xvf bison-3.0.4.tar.xz
-    pushd bison-3.0.4
+    pushd bison-3.0.4 || exit 1
     ./configure
     make
     sudo make install
-    popd
+    popd || exit 2
   fi
-
 }
 
 bootstrap_cmake(){

Reply via email to