meta-ibm: fix some shellcheck issues
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iced76041c1207dc9ab28a83fd849ba3cd0a07bb5
diff --git a/meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh b/meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
index eec96d3..0d1ff32 100755
--- a/meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
+++ b/meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
@@ -7,14 +7,14 @@
# Get current state
object=$(busctl tree $SERVICE --list | grep identify)
-state=$(busctl get-property $SERVICE $object $INTERFACE $PROPERTY \
+state=$(busctl get-property $SERVICE "$object" $INTERFACE $PROPERTY \
| awk '{print $NF;}')
-if [ "$state" == "false" ]; then
+if [ "$state" = "false" ]; then
target='true'
else
target='false'
fi
# Set target state
-busctl set-property $SERVICE $object $INTERFACE $PROPERTY b $target
+busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b $target
diff --git a/meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh b/meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh
index d405797..82351b9 100644
--- a/meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh
+++ b/meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh
@@ -45,10 +45,11 @@
ucdpath="/sys/bus/i2c/drivers/ucd9000"
if [ -e $ucdpath ]
then
- ucd=`ls -1 $ucdpath | grep 64`
+ # shellcheck disable=SC2010
+ ucd=$(ls -1 $ucdpath | grep 64)
if [ -n "$ucd" ]
then
- echo $ucd > $ucdpath/unbind
+ echo "$ucd" > $ucdpath/unbind
fi
fi
@@ -67,8 +68,8 @@
i2cset -y 11 0x64 0xF8 0x15 0x16 0x80 0x08 0x00 0x00 0x20 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 i
# change VDN delays based on UCD MFR_REVISION setting
-REV=`i2cget -y 11 0x64 0x9B i 2|cut -f2 -d' '`
-if [ "$REV" == "0x01" -o "$REV" == "0x02" ] ; then
+REV=$(i2cget -y 11 0x64 0x9B i 2|cut -f2 -d' ')
+if [ "$REV" = "0x01" ] || [ "$REV" = "0x02" ] ; then
# use 20ms delay for VDN
#TON_DELAY rail 8
i2cset -y 11 0x64 0x00 0x07 i
@@ -120,15 +121,16 @@
i2cset -y 5 0x70 0x46 0x0816 w # OC to 43A
# re-bind ucd driver only if we unbound it (i.e. ucd has been set with a value)
-if [ -e $ucdpath -a -n "$ucd" ]; then
+if [ -e $ucdpath ] && [ -n "$ucd" ]; then
j=0
- until [ $j -ge $ucd_retries ] || [ -e $ucdpath/$ucd ]; do
+ until [ $j -ge $ucd_retries ] || [ -e "$ucdpath/$ucd" ]; do
j=$((j+1))
- echo $ucd > $ucdpath/bind || ret=$?
+ # shellcheck disable=2320
+ echo "$ucd" > $ucdpath/bind || ret=$?
if [ $j -gt 1 ]; then
echo "rebinding UCD driver. Retry number $j"
sleep 1
fi
done
- if [ ! -e $ucdpath/$ucd ]; then exit $ret; fi
+ if [ ! -e "$ucdpath/$ucd" ]; then exit "$ret"; fi
fi
diff --git a/meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh b/meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh
index 85d7741..c35a61b 100644
--- a/meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh
+++ b/meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh
@@ -9,7 +9,7 @@
platform_path="/sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/"
unbind_driver () {
- echo $1 > $driver_path/unbind
+ echo "$1" > $driver_path/unbind
}
bind_driver () {
@@ -19,7 +19,8 @@
until [ $tries -ge $max_retries ]; do
tries=$((tries+1))
ret=0
- echo $device > $driver_path/bind || ret=$?
+ # shellcheck disable=SC2320
+ echo "$device" > $driver_path/bind || ret=$?
if [ $ret -ne 0 ]; then
echo "VRM $1 bind failed. Try $tries"
sleep 1
@@ -29,7 +30,7 @@
done
#Script will return a nonzero value if any binds fail.
- if [ $ret -ne 0 ]; then
+ if [ "$ret" -ne 0 ]; then
status=$ret
fi
}
@@ -78,4 +79,4 @@
fi
fi
-exit $status
+exit "$status"
diff --git a/meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh b/meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
index 496ece2..5cc68bb 100644
--- a/meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
+++ b/meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
@@ -8,20 +8,20 @@
# Get current state
object=$(busctl tree $SERVICE --list | grep identify)
led=$(cat /sys/devices/platform/leds/leds/front-id/brightness)
-if [ "$led" == "0" ]; then
- busctl set-property $SERVICE $object $INTERFACE $PROPERTY b false
+if [ "$led" = "0" ]; then
+ busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b false
else
- busctl set-property $SERVICE $object $INTERFACE $PROPERTY b true
+ busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b true
fi
-state=$(busctl get-property $SERVICE $object $INTERFACE $PROPERTY \
+state=$(busctl get-property $SERVICE "$object" $INTERFACE $PROPERTY \
| awk '{print $NF;}')
-if [ "$state" == "false" ]; then
+if [ "$state" = "false" ]; then
target='true'
else
target='false'
fi
# Set target state
-busctl set-property $SERVICE $object $INTERFACE $PROPERTY b $target
+busctl set-property $SERVICE "$object" $INTERFACE $PROPERTY b $target
diff --git a/meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh b/meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
index ec043ea..42fb25e 100644
--- a/meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
+++ b/meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
@@ -12,7 +12,7 @@
pnor="${pnormtd#mtd}"
pnordev="/dev/mtd${pnor}"
-if [[ ! "$(dd if=${pnordev} bs=1 count=3 2> /dev/null)" = "UBI" ]]; then
+if [ ! "$(dd if="${pnordev}" bs=1 count=3 2> /dev/null)" = "UBI" ]; then
echo "${pnordev} is not formatted UBI"
exit 1
fi
diff --git a/meta-phosphor/scripts/run-repotest b/meta-phosphor/scripts/run-repotest
index 69b34ee..c58be43 100755
--- a/meta-phosphor/scripts/run-repotest
+++ b/meta-phosphor/scripts/run-repotest
@@ -129,12 +129,7 @@
meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh
meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
-meta-ibm/meta-romulus/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
-meta-ibm/recipes-phosphor/chassis/power-workarounds/witherspoon/power-workarounds.sh
-meta-ibm/recipes-phosphor/chassis/vrm-control/ibm-ac-server/ir35221-unbind-bind.sh
meta-ibm/recipes-phosphor/chassis/vrm-control/vrm-control.sh
-meta-ibm/recipes-phosphor/gpio/id-button/toggle_identify_led.sh
-meta-ibm/recipes-phosphor/mboxd/mboxd/check_pnor_format.sh
meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh
meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh
meta-inventec/meta-transformers/recipes-phosphor/init/transformers-init/transformers-init.sh