meta-quanta: fix shellcheck issues

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I189baf142cc86d44ebbf615edd3bb0ec1785be8d
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
index bf71e94..32a595f 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
@@ -28,14 +28,9 @@
 # the node of FIU is spi for kernel 5.10, but
 # for less than or equal kernel 5.4, the node
 # is fiu
-for fname in $(find ${KERNEL_SYSFS_FIU} -type l)
-do
-    if [ "${fname##*\.}" == "fiu" ]
-    then
-        KERNEL_FIU_ID="c0000000.fiu"
-        break
-    fi
-done
+if ls "$KERNEL_SYSFS_FIU"/*.fiu 1> /dev/null 2>&1; then
+  KERNEL_FIU_ID="c0000000.fiu"
+fi
 
 IMAGE_FILE="/tmp/image-bios"
 
@@ -45,7 +40,7 @@
     m=$(grep -xl "$1" /sys/class/mtd/*/name)
     m=${m%/name}
     m=${m##*/}
-    echo $m
+    echo "$m"
 }
 
 cleanup() {
@@ -82,8 +77,7 @@
         exit 1
     fi
 
-    flashcp -v $IMAGE_FILE /dev/"${bios_mtd}"
-    if [ $? -eq 0 ]; then
+    if flashcp -v $IMAGE_FILE /dev/"${bios_mtd}" ; then
         echo "bios update successfully..."
     else
         echo "bios update failed..."
@@ -91,6 +85,6 @@
     fi
 }
 # Exit without running main() if sourced
-return 0 2>/dev/null
-
-main "$@"
+if ! (return 0 2>/dev/null); then
+    main "$@"
+fi
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
index 3da25e4..ac4ee1d 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
@@ -14,11 +14,11 @@
 
 if [ -e $IMAGE_FILE ] && [ -e $SIG_FILE ];
 then
-    sha256_image=`sha256sum "$IMAGE_FILE" | awk '{print $1}'`
-    sha256_file=`awk '{print $1}' $SIG_FILE`
+    sha256_image=$(sha256sum "$IMAGE_FILE" | awk '{print $1}')
+    sha256_file=$(awk '{print $1}' $SIG_FILE)
 fi
 
-if [[ $sha256_image != $sha256_file ]];
+if [ "$sha256_image" != "$sha256_file" ];
 then
     echo "bios image verify fail."
     rm -f $IMAGE_FILE
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
index bbaf15d..d45105d 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
@@ -9,7 +9,7 @@
 if [ -f $publickey ];then
     r="$(openssl dgst -verify $publickey -sha256 -signature $sigfile $bmcimage)"
     echo "$r" > $bmclog
-    if [[ "Verified OK" == "$r" ]]; then
+    if [ "Verified OK" = "$r" ]; then
         mv $bmcimage $imagebmc
         rm -f $sigfile
         exit 0
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
index cb652a2..b1bc46e 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
@@ -27,24 +27,24 @@
 LOG_GENID_FLAG="0x0020"
 present_state=("true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true")
 
-for i in ${!PRESENT_OBJPATH[@]}
+for i in "${!PRESENT_OBJPATH[@]}"
 do
-    mapper wait ${PRESENT_OBJPATH[$i]}
+    mapper wait "${PRESENT_OBJPATH[$i]}"
 done
 
 while true; do
-    for i in ${!PRESENT_OBJPATH[@]}
+    for i in "${!PRESENT_OBJPATH[@]}"
     do
-        boot_status="$(busctl get-property $SERVICE_NAME ${PRESENT_OBJPATH[$i]} $INTERFACE_NAME Present | awk '{print $2}')"
+        boot_status="$(busctl get-property $SERVICE_NAME "${PRESENT_OBJPATH[$i]}" $INTERFACE_NAME Present | awk '{print $2}')"
 
-        if [ $boot_status == "false" ] && [ ${present_state[$i]} == "true" ];then
-            echo "Update cable $(($i+1)) state."
-            present_state[$i]="false"
-            busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" ${PRESENT_OBJPATH[$i]} $LOG_EVENT_DATA $LOG_ASSERT_FLAG $LOG_GENID_FLAG
-        elif [ $boot_status == "true" ] && [ ${present_state[$i]} == "false" ];then
-            echo "Update cable $(($i+1)) state."
-            present_state[$i]="true"
-            busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" ${PRESENT_OBJPATH[$i]} $LOG_EVENT_DATA $LOG_DEASSERT_FLAG $LOG_GENID_FLAG
+        if [ "$boot_status" == "false" ] && [ "${present_state[$i]}" == "true" ];then
+            echo "Update cable $((i+1)) state."
+            present_state[i]="false"
+            busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" "${PRESENT_OBJPATH[$i]}" "$LOG_EVENT_DATA" $LOG_ASSERT_FLAG $LOG_GENID_FLAG
+        elif [ "$boot_status" == "true" ] && [ "${present_state[$i]}" == "false" ];then
+            echo "Update cable $((i+1)) state."
+            present_state[i]="true"
+            busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" "${PRESENT_OBJPATH[$i]}" "$LOG_EVENT_DATA" $LOG_DEASSERT_FLAG $LOG_GENID_FLAG
         fi
     done
     sleep 1
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
index 8b660c2..67636c1 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
+# shellcheck source=meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-gpio-common.sh
 source /usr/libexec/gbs-gpio-common.sh
 
 WD1RCR_ADDR=0xf080103c
@@ -44,36 +44,36 @@
 }
 
 get_board_rev_id() {
-    echo $(get_gpio_value 'BMC_BRD_REV_ID7')\
-    $(get_gpio_value 'BMC_BRD_REV_ID6')\
-    $(get_gpio_value 'BMC_BRD_REV_ID5')\
-    $(get_gpio_value 'BMC_BRD_REV_ID4')\
-    $(get_gpio_value 'BMC_BRD_REV_ID3')\
-    $(get_gpio_value 'BMC_BRD_REV_ID2')\
-    $(get_gpio_value 'BMC_BRD_REV_ID1')\
-    $(get_gpio_value 'BMC_BRD_REV_ID0')\
+    echo "$(get_gpio_value 'BMC_BRD_REV_ID7')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID6')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID5')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID4')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID3')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID2')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID1')"\
+    "$(get_gpio_value 'BMC_BRD_REV_ID0')"\
     | sed 's/ //g' > ~/board_rev_id.txt
 }
 
 get_board_sku_id() {
-    echo $(get_gpio_value 'BMC_BRD_SKU_ID3')\
-    $(get_gpio_value 'BMC_BRD_SKU_ID2')\
-    $(get_gpio_value 'BMC_BRD_SKU_ID1')\
-    $(get_gpio_value 'BMC_BRD_SKU_ID0')\
+    echo "$(get_gpio_value 'BMC_BRD_SKU_ID3')"\
+    "$(get_gpio_value 'BMC_BRD_SKU_ID2')"\
+    "$(get_gpio_value 'BMC_BRD_SKU_ID1')"\
+    "$(get_gpio_value 'BMC_BRD_SKU_ID0')"\
     | sed 's/ //g' > ~/board_sku_id.txt
 }
 
 get_hsbp_board_rev_id() {
-    echo $(get_gpio_value 'HSBP_BRD_REV_ID3')\
-    $(get_gpio_value 'HSBP_BRD_REV_ID2')\
-    $(get_gpio_value 'HSBP_BRD_REV_ID1')\
-    $(get_gpio_value 'HSBP_BRD_REV_ID0')\
+    echo "$(get_gpio_value 'HSBP_BRD_REV_ID3')"\
+    "$(get_gpio_value 'HSBP_BRD_REV_ID2')"\
+    "$(get_gpio_value 'HSBP_BRD_REV_ID1')"\
+    "$(get_gpio_value 'HSBP_BRD_REV_ID0')"\
     | sed 's/ //g' > ~/hsbp_board_rev_id.txt
 }
 
 get_fan_board_rev_id() {
-    echo $(get_gpio_value 'FAN_BRD_REV_ID1')\
-    $(get_gpio_value 'FAN_BRD_REV_ID0')\
+    echo "$(get_gpio_value 'FAN_BRD_REV_ID1')"\
+    "$(get_gpio_value 'FAN_BRD_REV_ID0')"\
     | sed 's/ //g' > ~/fan_board_rev_id.txt
 }
 
@@ -100,10 +100,8 @@
   sku1_val=$(get_gpio_value 'BMC_BRD_SKU_ID1')
   if (( sku1_val == 1 )); then
     echo "GBS SKU!"
-    BOARD_SKU="GBS"
   else
     echo "Other SKU!"
-    BOARD_SKU="TBD"
   fi
 }
 
@@ -134,11 +132,9 @@
 # the node of FIU is spi for kernel 5.10, but
 # for less than or equal kernel 5.4, the node
 # is fiu
-shopt -s nullglob
-for fiu in "$KERNEL_SYSFS_FIU"/*.fiu; do
+if ls "$KERNEL_SYSFS_FIU"/*.fiu 1> /dev/null 2>&1; then
   KERNEL_FIU_ID="c0000000.fiu"
-  break
-done
+fi
 
 bind_host_mtd() {
   set_gpio_direction 'SPI_SW_SELECT' high
@@ -162,7 +158,7 @@
   m=$(grep -xl "$1" /sys/class/mtd/*/name)
   m=${m%/name}
   m=${m##*/}
-  echo $m
+  echo "$m"
 }
 
 verify_host_bios() {
@@ -176,7 +172,7 @@
   [[ -z "${pnor_mtd}" ]] && { echo "Failed to find host MTD  partition!"; return 1; }
 
   # Test timing by computing SHA256SUM.
-  sha256sum /dev/${pnor_mtd}ro
+  sha256sum "/dev/${pnor_mtd}ro"
 
   echo "BIOS verification complete!"
   unbind_host_mtd
@@ -186,12 +182,12 @@
   pe_fruid=3
   for i in {1..2};
   do
-     mapper wait ${PE_PRESENT_OBJPATH[$(($i-1))]}
-     pe_prsnt_n="$(busctl get-property $SERVICE_NAME ${PE_PRESENT_OBJPATH[$(($i-1))]} \
+     mapper wait "${PE_PRESENT_OBJPATH[$((i-1))]}"
+     pe_prsnt_n="$(busctl get-property $SERVICE_NAME "${PE_PRESENT_OBJPATH[$((i-1))]}" \
                   $INTERFACE_NAME Present)"
 
      if [[ ${pe_prsnt_n} == "b false" ]]; then
-         pe_fruid=$(($pe_fruid+1))
+         pe_fruid=$((pe_fruid+1))
          continue
      fi
 
@@ -199,6 +195,7 @@
      # i2c-0 -> i2c mux (addr: 0x71) -> PE0/PE1
      # PE0: channel 0
      # PE1: channel 1
+     # shellcheck disable=SC2010
      pe_fru_bus="$(ls -al /sys/bus/i2c/drivers/pca954x/0-0071/ | grep channel \
                    | awk -F "/" '{print $(NF)}' | awk -F "-" '{print $2}' | sed -n "${i}p")"
 
@@ -206,17 +203,16 @@
      # EEPROM part number) and perform a phosphor-read-eeprom
      for ((j=0; j < ${#pe_eeprom_addr[@]}; j++));
      do
-        i2cget -f -y $pe_fru_bus "0x${pe_eeprom_addr[$j]}" 0x01 > /dev/null 2>&1
-        if [ $? -eq 0 ]; then
+        if i2cget -f -y "$pe_fru_bus" "0x${pe_eeprom_addr[$j]}" 0x01 > /dev/null 2>&1 ; then
           if [ ! -f "/sys/bus/i2c/devices/$pe_fru_bus-00${pe_eeprom_addr[$j]}/eeprom" ]; then
             echo 24c02 "0x${pe_eeprom_addr[$j]}" > "/sys/bus/i2c/devices/i2c-$pe_fru_bus/new_device"
           fi
           pe_fru_bus="/sys/bus/i2c/devices/$pe_fru_bus-00${pe_eeprom_addr[$j]}/eeprom"
-          phosphor-read-eeprom --eeprom $pe_fru_bus --fruid $pe_fruid
+          phosphor-read-eeprom --eeprom "$pe_fru_bus" --fruid $pe_fruid
           break
         fi
      done
-     pe_fruid=$(($pe_fruid+1))
+     pe_fruid=$((pe_fruid+1))
   done
 }
 
@@ -224,7 +220,7 @@
     res0="$(busctl get-property -j xyz.openbmc_project.State.Chassis \
         /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis \
         CurrentPowerState | jq -r '.["data"]')"
-    echo $res0
+    echo "$res0"
 }
 
 clk_buf_bus_switch="11-0076"
@@ -277,6 +273,6 @@
 }
 
 # Exit without running main() if sourced
-return 0 2>/dev/null
-
-main "$@"
+if ! (return 0 2>/dev/null) ; then
+    main "$@"
+fi
diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
index e22dd20..14136b7 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
@@ -27,12 +27,12 @@
 main() {
   # Stop phosphor-hwmon so that ADM1272 powercycle doesn't happen
   # in the middle of an i2c transaction and stuck the bus low
-  stop_phosphor_hwmon
+  stop_phosphor_hwmon "$@"
 
   gpioset gpiochip6 26=1
 }
 
 # Exit without running main() if sourced
-return 0 2>/dev/null
-
-main "$@"
+if ! (return 0 2>/dev/null) ; then
+    main "$@"
+fi
diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
index 1bff18d..97f9cfe 100644
--- a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
+++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
@@ -5,8 +5,8 @@
 dbus-monitor --system type='signal',interface='org.freedesktop.DBus.Properties',\
 member='PropertiesChanged',arg0namespace='xyz.openbmc_project.State.Chassis' | \
 while read -r line; do
-  grep -q member <<< $line && continue
-  if grep -q $state <<< $line; then
+  grep -q member <<< "$line" && continue
+  if grep -q $state <<< "$line"; then
     echo "Setting failsafe assuming host is off" >&2
     systemctl start --no-block gbs-host-s5-set-failsafe
   fi
diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
index bcd1d2c..8d6f774 100644
--- a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
+++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
@@ -22,10 +22,10 @@
   exit 1
 fi
 
-zone_num="$(busctl tree xyz.openbmc_project.State.FanCtrl | grep zone | wc -l)"
+zone_num="$(busctl tree xyz.openbmc_project.State.FanCtrl | grep -c zone)"
 result=0
 
-for (( i = 0; i < ${zone_num}; i++ )); do
+for (( i = 0; i < zone_num; i++ )); do
   retries=4
   busctl_error=-1
 
@@ -39,7 +39,7 @@
       sleep 1
     fi
 
-    let retries-=1
+    (( retries-=1 )) || true
   done
 
   if (( busctl_error != 0 )); then
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
index 5ceac7e..427c98e 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
@@ -12,29 +12,29 @@
 mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan2
 
 # generate fan table writePath
-Fan_0_To_4_Hwmon="$(ls /sys/devices/platform/ahb/ahb\:*/*pwm-fan-controller/hwmon/)"
+Fan_0_To_4_Hwmon="$(ls /sys/devices/platform/ahb/ahb:*/*pwm-fan-controller/hwmon/)"
 
 if [[ "$Fan_0_To_4_Hwmon" != "" ]]; then
-    sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" $TEMP_FILE
+    sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" "$TEMP_FILE"
 fi
 
 presentGpio=()
 presentState=()
 gpioPath="/sys/class/gpio/gpio"
 if [[ -f "/etc/nvme/nvme_config.json" ]]; then
-    presentGpio=($(cat /etc/nvme/nvme_config.json | grep NVMeDrivePresentPin \
+    # shellcheck disable=SC2207
+    presentGpio=($(grep NVMeDrivePresentPin /etc/nvme/nvme_config.json \
                    | awk '{print $2}' | cut -d "," -f 0))
 fi
 
 nvmePath="/xyz/openbmc_project/sensors/temperature/nvme"
-nvmeInventoryPath="/xyz/openbmc_project/inventory/system/chassis/motherboard/nvme"
 # Get and Set WCTEMP
 for ((i = 0; i < 16; i++)); do
     name="@WCTemp$(printf "%02d" $i)@"
     wcTemp=72000
 
     if [[ -d "${gpioPath}${presentGpio[i]}" ]] &&
-       [[ "$(cat ${gpioPath}${presentGpio[i]}/value)" == "0" ]]; then
+       [[ "$(cat "${gpioPath}${presentGpio[i]}/value")" == "0" ]]; then
         presentState[i]="true"
     else
         presentState[i]="false"
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
index c8e328a..323be60 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
+++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
@@ -4,7 +4,7 @@
 
 export_gpio() {
   if [ ! -d "/sys/class/gpio/gpio$1" ]; then
-    echo $1 >/sys/class/gpio/export
+    echo "$1" >/sys/class/gpio/export
   fi
 }
 
@@ -18,8 +18,7 @@
     presentPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0024/gpio/gpiochip*/base)"
     for i in {0..15};
     do
-        let presentPinBase[$i]=presentPinBase+$i
-        export_gpio ${presentPinBase[$i]}
+        export_gpio $(( presentPinBase + i ))
     done
 else
     echo "Can't find present gpio expander (addr: 0x24) !!"
@@ -29,8 +28,7 @@
     PwrGoodPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0021/gpio/gpiochip*/base)"
     for i in {0..15};
     do
-        let PwrGoodPinBase[$i]=PwrGoodPinBase+$i
-        export_gpio ${PwrGoodPinBase[$i]}
+        export_gpio $(( PwrGoodPinBase + i ))
     done
 else
     echo "Can't find powergood gpio expander (addr: 0x21) !!"
@@ -46,8 +44,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[3]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[3]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 3)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 3))
         },
         {
             "NVMeDriveIndex": 1,
@@ -56,8 +54,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[2]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[2]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 2)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 2))
         },
         {
             "NVMeDriveIndex": 2,
@@ -66,8 +64,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[1]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[1]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 1)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 1))
         },
         {
             "NVMeDriveIndex": 3,
@@ -76,8 +74,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[0]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[0]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 0)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 0))
         },
         {
             "NVMeDriveIndex": 4,
@@ -86,8 +84,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[7]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[7]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 7)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 7))
         },
         {
             "NVMeDriveIndex": 5,
@@ -96,8 +94,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[6]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[6]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 6)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 6))
         },
         {
             "NVMeDriveIndex": 6,
@@ -106,8 +104,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[5]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[5]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 5)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 5))
         },
         {
             "NVMeDriveIndex": 7,
@@ -116,8 +114,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[4]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[4]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 4)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 4))
         },
         {
             "NVMeDriveIndex": 8,
@@ -126,8 +124,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[11]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[11]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 11)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 11))
         },
         {
             "NVMeDriveIndex": 9,
@@ -136,8 +134,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[10]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[10]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 10)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 10))
         },
         {
             "NVMeDriveIndex": 10,
@@ -146,8 +144,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[9]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[9]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 9)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 9))
         },
         {
             "NVMeDriveIndex": 11,
@@ -156,8 +154,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[8]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[8]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 8)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 8))
         },
         {
             "NVMeDriveIndex": 12,
@@ -166,8 +164,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[15]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[15]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 15)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 15))
         },
         {
             "NVMeDriveIndex": 13,
@@ -176,8 +174,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[14]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[14]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 14)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 14))
         },
         {
             "NVMeDriveIndex": 14,
@@ -186,8 +184,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[13]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[13]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 13)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 13))
         },
         {
             "NVMeDriveIndex": 15,
@@ -196,8 +194,8 @@
             "NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate",
             "NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate",
             "NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate",
-            "NVMeDrivePresentPin": ${presentPinBase[12]},
-            "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[12]}
+            "NVMeDrivePresentPin": $(( presentPinBase + 12)),
+            "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 12))
         }
     ],
     "threshold": [