Browse Source

fixes for shell script errors detected by shellcheck --severity=error.

Daniel Pouzzner 2 years ago
parent
commit
c9a7393923

+ 1 - 1
IDE/HEXAGON/build.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 if [ -z $1 ]; then
 	echo "./build <Debug | Release>"
-	exit -1
+	exit 1
 fi
 
 printf "Erasing previous hexagon_$1_dynamic_toolv83_v65 and UbuntuARM_$1_aarch64\n"

+ 2 - 0
IDE/MYSQL/do.sh

@@ -1,3 +1,5 @@
+#!/bin/sh
+
 # Place CMakeList in needed directories
 
 cp CMakeLists_wolfSSL.txt ../../CMakeLists.txt

+ 2 - 0
certs/gen_revoked.sh

@@ -1,3 +1,5 @@
+#!/bin/sh
+
     ###########################################################
     ########## update and sign server-revoked-key.pem ################
     ###########################################################

+ 10 - 7
certs/test/gen-testcerts.sh

@@ -54,13 +54,16 @@ build_test_cert_conf() {
     echo ""                                             >> "$1".conf
     if [ -n "$3" ]; then
         echo "[ req_ext ]"                              >> "$1".conf
-        if [ "$3" != *"DER"* ]; then
-            echo "subjectAltName = @alt_names"          >> "$1".conf
-            echo "[alt_names]"                          >> "$1".conf
-            echo "DNS.1 = $3"                           >> "$1".conf
-        else
-            echo "subjectAltName = $3"                  >> "$1".conf
-        fi
+	case "$3" in
+	    *DER*)
+               echo "subjectAltName = $3"               >> "$1".conf
+	       ;;
+	    *)
+               echo "subjectAltName = @alt_names"       >> "$1".conf
+               echo "[alt_names]"                       >> "$1".conf
+               echo "DNS.1 = $3"                        >> "$1".conf
+	       ;;
+	esac
     fi
 }
 

+ 1 - 1
doc/generate_documentation.sh

@@ -34,7 +34,7 @@ fi
 
 # Checking arguments and setting appropriate option variables
 
-for var in $@
+for var in "$@"
 do
     case $var in
     -install)

+ 1 - 1
scripts/benchmark.test

@@ -43,7 +43,7 @@ do_cleanup() {
 do_trap() {
     echo "got trap"
     do_cleanup
-    exit -1
+    exit 1
 }
 
 trap do_trap INT TERM

+ 1 - 1
scripts/ocsp-stapling-with-ca-as-responder.test

@@ -230,7 +230,7 @@ openssl ocsp -port $port1 -nmin 1                               \
     -rsigner certs/ocsp/intermediate1-ca-cert.pem               \
     -rkey    certs/ocsp/intermediate1-ca-key.pem                \
     -CA      certs/ocsp/intermediate1-ca-cert.pem               \
-    $@                                                          \
+    "$@"                                                        \
     &
 
 sleep 0.1

+ 6 - 6
scripts/ocsp-stapling2.test

@@ -296,34 +296,34 @@ sleep 0.1
 # OLD: ./certs/ocsp/ocspd-root-ca-and-intermediate-cas.sh &
 # NEW: openssl isn't being cleaned up, invoke directly in script for cleanup
 # purposes!
-openssl ocsp -port $port1 -nmin 1                \
+openssl ocsp -port $port1 -nmin 1                         \
     -index   certs/ocsp/index-ca-and-intermediate-cas.txt \
     -rsigner certs/ocsp/ocsp-responder-cert.pem           \
     -rkey    certs/ocsp/ocsp-responder-key.pem            \
     -CA      certs/ocsp/root-ca-cert.pem                  \
-    $@                                                    \
+    "$@"                                                  \
     &
 
 # OLD: ./certs/ocsp/ocspd-intermediate2-ca-issued-certs.sh &
 # NEW: openssl isn't being cleaned up, invoke directly in script for cleanup
 # purposes!
-openssl ocsp -port $port2 -nmin 1                      \
+openssl ocsp -port $port2 -nmin 1                               \
     -index   certs/ocsp/index-intermediate2-ca-issued-certs.txt \
     -rsigner certs/ocsp/ocsp-responder-cert.pem                 \
     -rkey    certs/ocsp/ocsp-responder-key.pem                  \
     -CA      certs/ocsp/intermediate2-ca-cert.pem               \
-    $@                                                          \
+    "$@"                                                        \
     &
 
 # OLD: ./certs/ocsp/ocspd-intermediate3-ca-issued-certs.sh &
 # NEW: openssl isn't being cleaned up, invoke directly in script for cleanup
 # purposes!
-openssl ocsp -port $port3 -nmin 1                      \
+openssl ocsp -port $port3 -nmin 1                               \
     -index   certs/ocsp/index-intermediate3-ca-issued-certs.txt \
     -rsigner certs/ocsp/ocsp-responder-cert.pem                 \
     -rkey    certs/ocsp/ocsp-responder-key.pem                  \
     -CA      certs/ocsp/intermediate3-ca-cert.pem               \
-    $@                                                          \
+    "$@"                                                        \
     &
 
 sleep 0.1

+ 4 - 3
scripts/openssl.test

@@ -407,11 +407,12 @@ command -v $OPENSSL >/dev/null 2>&1 || { echo >&2 "Requires openssl command, but
 
 echo -e "\nTesting for _build directory as part of distcheck, different paths"
 currentDir=`pwd`
-if [ "$currentDir" = *"_build" ]
-then
+case "$currentDir" in
+*_build)
     echo -e "_build directory detected, moving a directory back"
     cd ..
-fi
+    ;;
+esac
 echo -e "\nChecking for wolfSSL client - needed for cipher list"
 wolfssl_client_avail=`$WOLFSSL_CLIENT -?`
 case $wolfssl_client_avail in

+ 1 - 1
scripts/openssl_srtp.test

@@ -120,7 +120,7 @@ check_dtls_srtp() {
     echo -n "check dtls $1 $2... "
     if [ $check_ret -ne 0 ];then
         echo "failed"
-        exit -1
+        exit 1
     else
         echo "ok"
     fi

+ 1 - 1
scripts/psk.test

@@ -69,7 +69,7 @@ do_cleanup() {
 do_trap() {
     echo "got trap"
     do_cleanup
-    exit -1
+    exit 1
 }
 
 trap do_trap INT TERM

+ 1 - 1
scripts/resume.test

@@ -50,7 +50,7 @@ do_cleanup() {
 do_trap() {
     echo "got trap"
     do_cleanup
-    exit -1
+    exit 1
 }
 
 do_test() {

+ 1 - 1
scripts/tls13.test

@@ -90,7 +90,7 @@ do_cleanup() {
 do_trap() {
     echo "got trap"
     do_cleanup
-    exit -1
+    exit 1
 }
 
 trap do_trap INT TERM

+ 1 - 1
scripts/trusted_peer.test

@@ -80,7 +80,7 @@ do_cleanup() {
 do_trap() {
     echo "got trap"
     do_cleanup
-    exit -1
+    exit 1
 }
 
 trap do_trap INT TERM

+ 2 - 0
wrapper/python/wolfcrypt/.centos-provisioner.sh

@@ -1,3 +1,5 @@
+#!/bin/sh
+
 [ "$(whoami)" != "root" ] && echo "Sorry, you are not root." && exit 1
 
 rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm

+ 2 - 0
wrapper/python/wolfcrypt/.ubuntu-provisioner.sh

@@ -1,3 +1,5 @@
+#!/bin/sh
+
 [ "$(whoami)" != "root" ] && echo "Sorry, you are not root." && exit 1
 
 apt-get update

+ 2 - 0
wrapper/python/wolfssl/.centos-provisioner.sh

@@ -1,3 +1,5 @@
+#!/bin/sh
+
 [ "$(whoami)" != "root" ] && echo "Sorry, you are not root." && exit 1
 
 rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

+ 2 - 0
wrapper/python/wolfssl/.ubuntu-provisioner.sh

@@ -1,3 +1,5 @@
+#!/bin/sh
+
 [ "$(whoami)" != "root" ] && echo "Sorry, you are not root." && exit 1
 
 apt-get update