diff options
author | Thang Q. Nguyen <thang@os.amperecomputing.com> | 2021-11-04 11:30:27 +0300 |
---|---|---|
committer | Thang Q. Nguyen <thang@os.amperecomputing.com> | 2021-11-04 16:10:58 +0300 |
commit | dde1fede1f832f029742a1d27290cfe252ab1bc5 (patch) | |
tree | d8e4bbb3ee309dbcc4324a98682bbf444bbe8ca2 /meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset | |
parent | 5a5f33c729e6b5869362172b63595422eb84a418 (diff) | |
download | openbmc-dde1fede1f832f029742a1d27290cfe252ab1bc5.tar.xz |
meta-ampere: fix shellcheck issues
Fix all issues from the shellcheck checked on bash shells under
meta-ampere.
Tested: Verify the following features:
1. Power control (on,off, cycle, graceful shutdown, hard reset).
2. UART switching.
3. UEFI firmware update.
Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: Idabf839b7521ecadb642230cc8bb3472c787002e
Diffstat (limited to 'meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset')
-rwxr-xr-x[-rw-r--r--] | meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh index 65bff9dc1..37a3ce301 100644..100755 --- a/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh +++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh @@ -29,10 +29,10 @@ STATUS_MFR_SPECIFIC=0x80 # $1 will be the name of the psu PSU=$1 -if [[ $PSU == 1 ]]; then +if [ "$PSU" = 1 ]; then HSC_PMBUS_NUM=$HSC1_PMBUS_NUM HSC_SLAVE_ADDR=$HSC1_SLAVE_ADDR -elif [[ $PSU == 2 ]]; then +elif [ "$PSU" = 2 ]; then HSC_PMBUS_NUM=$HSC2_PMBUS_NUM HSC_SLAVE_ADDR=$HSC2_SLAVE_ADDR else @@ -43,22 +43,20 @@ fi # Check HOST state chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}') -if [[ "$chassisstate" == 'Off' ]]; then +if [ "$chassisstate" = 'Off' ]; then echo "HOST is being OFF, so can't access the i2c $HSC_PMBUS_NUM. Please Turn ON HOST !" exit 1 fi # Check FET health problems -data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC) - -if [[ $? -ne 0 ]]; then +if ! data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC); then echo "ERROR: Can't access the i2c. Please check /dev/i2c-$HSC_PMBUS_NUM" exit 1 fi psu_sts=$(((data & 0x80) != 0)) -if [[ $psu_sts == 1 ]]; then +if [ $psu_sts = 1 ]; then echo "PSU $PSU: FET health problems have been detected" echo "Reset Hot swap output on PSU $PSU" # Disable Hot swap output @@ -71,4 +69,4 @@ if [[ $psu_sts == 1 ]]; then else echo "PSU $PSU: FET health problems have not been detected" -fi
\ No newline at end of file +fi |