meta-ibm: fix some shellcheck issues
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iced76041c1207dc9ab28a83fd849ba3cd0a07bb5
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"