meta-openpower: fix shellcheck issues

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I35a9ffed937919467dec62a1fbff729f4a51366c
diff --git a/meta-openpower/recipes-bsp/pdata/files/power-target.sh b/meta-openpower/recipes-bsp/pdata/files/power-target.sh
index 4a02419..1a871d4 100755
--- a/meta-openpower/recipes-bsp/pdata/files/power-target.sh
+++ b/meta-openpower/recipes-bsp/pdata/files/power-target.sh
@@ -1,3 +1,5 @@
+#!/bin/sh
+
 # Command line debug tools like pdbg and ecmd requires
 # PDBG_DTB environment variable.
 # attributes tool required PDBG_DTB, PDATA_INFODB and PDATA_ATTR_OVERRIDE
diff --git a/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh b/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
index eaabb0a..5879fed 100644
--- a/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
+++ b/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
@@ -29,11 +29,11 @@
     BMC_ITEM_PATH=${BMC_ITEM_PATH%\"*}
 
     BMC_ITEM_SERVICE=$(mapper get-service \
-                                ${BMC_ITEM_PATH} 2>/dev/null || true)
+                                "${BMC_ITEM_PATH}" 2>/dev/null || true)
 
-    if [[ -n "${BMC_ITEM_SERVICE}" ]]; then
-        BMC_SN=$(busctl get-property ${BMC_ITEM_SERVICE} \
-                            ${BMC_ITEM_PATH} \
+    if [ -n "${BMC_ITEM_SERVICE}" ]; then
+        BMC_SN=$(busctl get-property "${BMC_ITEM_SERVICE}" \
+                            "${BMC_ITEM_PATH}" \
                             ${INV_ASSET_IFACE} SerialNumber)
         # 's "002B0DH1000"'
         BMC_SN=${BMC_SN#*\"}
@@ -42,7 +42,7 @@
         show_error "No BMC item found in the Inventory. Is VPD EEPROM empty?"
     fi
 
-    if [[ -z "${BMC_SN}" ]] ; then
+    if [ -z "${BMC_SN}" ] ; then
         show_error "BMC Serial Number empty! Setting Hostname as 'hostname + mac address' "
 
         NETWORK_ITEM_IFACE='xyz.openbmc_project.Inventory.Item.NetworkInterface'
@@ -57,24 +57,24 @@
         NETWORK_ITEM_PATH=${NETWORK_ITEM_PATH#*\"}
         NETWORK_ITEM_PATH=${NETWORK_ITEM_PATH%\"*}
 
-        NETWORK_ITEM_OBJ=$(mapper get-service ${NETWORK_ITEM_PATH} 2>/dev/null || true)
+        NETWORK_ITEM_OBJ=$(mapper get-service "${NETWORK_ITEM_PATH}" 2>/dev/null || true)
 
-        if [[ -z "${NETWORK_ITEM_OBJ}" ]]; then
+        if [ -z "${NETWORK_ITEM_OBJ}" ]; then
             show_error 'No Ethernet interface found in the Inventory. Unique hostname not set!'
             exit 1
         fi
 
-        MAC_ADDR=$(busctl get-property ${NETWORK_ITEM_OBJ} \
-                               ${NETWORK_ITEM_PATH} \
-                               ${NETWORK_ITEM_IFACE} MACAddress)
+        MAC_ADDR=$(busctl get-property "${NETWORK_ITEM_OBJ}" \
+                               "${NETWORK_ITEM_PATH}" \
+                               "${NETWORK_ITEM_IFACE}" MACAddress)
 
         # 's "54:52:01:02:03:04"'
         MAC_ADDR=${MAC_ADDR#*\"}
         MAC_ADDR=${MAC_ADDR%\"*}
 
-        hostnamectl set-hostname $(hostname)-${MAC_ADDR}
+        hostnamectl set-hostname "$(hostname)-${MAC_ADDR}"
     else
-        hostnamectl set-hostname $(hostname)-${BMC_SN}
+        hostnamectl set-hostname "$(hostname)-${BMC_SN}"
     fi
 
 }
diff --git a/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh b/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
index 63a4ad7..8e00eb1 100755
--- a/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
+++ b/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
@@ -22,9 +22,9 @@
                             ${MAPPER_IFACE} \
                             GetSubTree sias \
                             ${INVENTORY_PATH} 0 1 ${NETWORK_ITEM_IFACE} \
-                        2>/dev/null | grep ${INVENTORY_PATH} | wc -l || true)
+                        2>/dev/null | grep -c ${INVENTORY_PATH} || true)
 
-    if [ $NETWORK_ITEM_PATH_COUNT -gt 1 ]; then
+    if [ "$NETWORK_ITEM_PATH_COUNT" -gt 1 ]; then
         # If there are more than 2 NETOWRK ITEM and path must contain $1
         # for finding the right NETWORK ITEM
         NETWORK_ITEM_PATH=$(busctl --no-pager --verbose call \
@@ -33,7 +33,7 @@
                             ${MAPPER_IFACE} \
                             GetSubTree sias \
                             ${INVENTORY_PATH} 0 1 ${NETWORK_ITEM_IFACE} \
-                        2>/dev/null | grep ${INVENTORY_PATH} | grep $1 || true)
+                        2>/dev/null | grep ${INVENTORY_PATH} | grep "$1" || true)
     else
         NETWORK_ITEM_PATH=$(busctl --no-pager --verbose call \
                             ${MAPPER_IFACE} \
@@ -49,26 +49,26 @@
     NETWORK_ITEM_PATH=${NETWORK_ITEM_PATH%\"*}
 
     NETWORK_ITEM_SERVICE=$(mapper get-service \
-                                ${NETWORK_ITEM_PATH} 2>/dev/null || true)
+                                "${NETWORK_ITEM_PATH}" 2>/dev/null || true)
 
-    if [[ -z "${NETWORK_ITEM_SERVICE}" ]]; then
+    if [ -z "${NETWORK_ITEM_SERVICE}" ]; then
         show_error 'No Ethernet interface found in the Inventory. Is VPD EEPROM empty?'
         return
     fi
 
-    MAC_ADDR=$(busctl get-property ${NETWORK_ITEM_SERVICE} \
-                                ${NETWORK_ITEM_PATH} \
-                                ${NETWORK_ITEM_IFACE} MACAddress)
+    MAC_ADDR=$(busctl get-property "${NETWORK_ITEM_SERVICE}" \
+                                "${NETWORK_ITEM_PATH}" \
+                                "${NETWORK_ITEM_IFACE}" MACAddress)
 
     # 's "54:52:01:02:03:04"'
     MAC_ADDR=${MAC_ADDR#*\"}
     MAC_ADDR=${MAC_ADDR%\"*}
 
-    if [[ -n "${MAC_ADDR}" ]]; then
+    if [ -n "${MAC_ADDR}" ]; then
         busctl set-property xyz.openbmc_project.Network \
-                            /xyz/openbmc_project/network/$1 \
+                            "/xyz/openbmc_project/network/$1" \
                             xyz.openbmc_project.Network.MACAddress \
-                            MACAddress s ${MAC_ADDR}
+                            MACAddress s "${MAC_ADDR}"
     fi
 }
 
@@ -77,7 +77,7 @@
     exit 1
 fi
 
-sync_mac $1
+sync_mac "$1"
 
 # Prevent start at next boot time
 mkdir -p "/var/lib/first-boot-set-mac"
diff --git a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
index dc1f39b..bb9e482 100755
--- a/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
+++ b/meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
@@ -1,15 +1,15 @@
 #!/bin/sh
 # set and unset occ active for all occ's in system
 
-if [ "$1" == "disable" ]; then
+if [ "$1" = "disable" ]; then
     value='false'
-elif [ "$1" == "enable" ]; then
+elif [ "$1" = "enable" ]; then
     value='true'
 else
     echo "Usage: occ-active.sh [argument]"
     echo "  enable  - set occ's to active state"
     echo "  disable - set occ's to inactive state"
-    exit -1
+    exit 1
 fi
 
 OCC_CONTROL_SERVICE="org.open_power.OCC.Control"
diff --git a/meta-phosphor/scripts/run-repotest b/meta-phosphor/scripts/run-repotest
index cbb7f42..27bf738 100755
--- a/meta-phosphor/scripts/run-repotest
+++ b/meta-phosphor/scripts/run-repotest
@@ -128,10 +128,6 @@
 meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
 meta-ibm/recipes-phosphor/chassis/vrm-control/vrm-control.sh
 meta-inventec/meta-transformers/recipes-phosphor/init/transformers-init/transformers-init.sh
-meta-openpower/recipes-bsp/pdata/files/power-target.sh
-meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
-meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
-meta-openpower/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
 meta-phosphor/recipes-support/nss-pam-ldapd/files/nslcd.init
 meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh
 meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh