diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2023-04-14 23:08:08 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-04-19 04:37:09 +0300 |
commit | 9b8716888b838a9985a313d8c2ed287497d851e7 (patch) | |
tree | 98f2cbb238baaed45d1b814a7a012ce2bf7b3779 /meta-ibm/recipes-phosphor | |
parent | 51d6af4e64f0ca08e6b8322b0cac94b93e5d5e27 (diff) | |
download | openbmc-9b8716888b838a9985a313d8c2ed287497d851e7.tar.xz |
meta-ibm: fix some shellcheck issues
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Iced76041c1207dc9ab28a83fd849ba3cd0a07bb5
Diffstat (limited to 'meta-ibm/recipes-phosphor')
4 files changed, 22 insertions, 19 deletions
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 d405797311..82351b9266 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 @@ ucd= 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 0xF7 0x01 i 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 0x00 0x01 # PAGE 1 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 85d77412d5..c35a61bdb8 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 @@ driver_path="/sys/bus/i2c/drivers/ir35221/" 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 @@ bind_driver () { 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 @@ bind_driver () { 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 @@ then 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 496ece2b29..5cc68bbbc0 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 @@ PROPERTY="Asserted" # 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 ec043eaf9e..42fb25e2f6 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 @@ pnormtd="$(findmtd pnor)" 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 |