generate-psu-tar: fix shellcheck warnings

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib8db3d15478a0102f5d7c68ce67f5dcdebf9e775
diff --git a/tools/generate-psu-tar b/tools/generate-psu-tar
index 5bbc60c..1f7e9c2 100755
--- a/tools/generate-psu-tar
+++ b/tools/generate-psu-tar
@@ -39,6 +39,7 @@
 '
 
 do_sign=false
+# shellcheck disable=SC2153
 private_key_path="${PRIVATE_KEY_PATH}"
 image=""
 outfile=""
@@ -46,7 +47,6 @@
 model=""
 manufacture=""
 machineName=""
-declare -a partitions=()
 
 
 while [[ $# -gt 0 ]]; do
@@ -78,7 +78,7 @@
       ;;
     --sign)
       do_sign=true
-      if [[ ! -z "${2}"  && "${2}" != -* ]]; then
+      if [[ -n "${2}"  && "${2}" != -* ]]; then
         private_key_path="$2"
         shift 2
       else
@@ -123,12 +123,13 @@
 fi
 
 if [  -z "${outfile}" ]; then
-  outfile=`pwd`/$image.tar
+    outfile=$(pwd)/$image.tar
 else
-  outfile=`pwd`/$outfile
+    outfile=$(pwd)/$outfile
 fi
 
-scratch_dir=`mktemp -d`
+scratch_dir=$(mktemp -d)
+# shellcheck disable=SC2064
 trap "{ rm -r ${scratch_dir}; }" EXIT
 
 if [[ "${do_sign}" == true ]]; then
@@ -149,21 +150,21 @@
   public_key_path=${scratch_dir}/$public_key_file
   openssl pkey -in "${private_key_path}" -pubout -out "${public_key_path}"
 
-  cp ${private_key_path} ${scratch_dir}/private_key
+  cp "${private_key_path}" "${scratch_dir}/private_key"
 
 fi
 
 manifest_location="MANIFEST"
 files_to_sign="$manifest_location $public_key_file $image"
 
-cp ${image} ${scratch_dir}
+cp "${image}" "${scratch_dir}"
 cd "${scratch_dir}"
 
 echo "Creating MANIFEST for the image"
 echo -e "purpose=xyz.openbmc_project.Software.Version.VersionPurpose.PSU\nversion=$version\n\
 extended_version=model=$model,manufacture=$manufacture" > $manifest_location
 
-if [[ ! -z "${machineName}" ]]; then
+if [[ -n "${machineName}" ]]; then
     echo -e "MachineName=${machineName}" >> $manifest_location
 fi
 
@@ -174,12 +175,12 @@
   echo HashType="RSA-SHA256" >> $manifest_location
 
   for file in $files_to_sign; do
-    openssl dgst -sha256 -sign private_key -out "${file}.sig" $file
+    openssl dgst -sha256 -sign private_key -out "${file}.sig" "$file"
   done
 
   additional_files="*.sig"
 fi
 
-tar -cvf $outfile $files_to_sign $additional_files
+tar -cvf "$outfile" "$files_to_sign" "$additional_files"
 echo "PSU FW tarball at $outfile"
 exit