summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2023-04-16 04:05:21 +0300
committerPatrick Williams <patrick@stwcx.xyz>2023-04-27 19:16:12 +0300
commit8c2262344c1fc1f8708f4a44af395ea8c49f12e2 (patch)
treec77f039128cd588f75b89a2272248960b3482baf
parentbd58e95482128fa5aefb97125613e6b23723e85e (diff)
downloadopenbmc-8c2262344c1fc1f8708f4a44af395ea8c49f12e2.tar.xz
meta-quanta: fix shellcheck issues
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I189baf142cc86d44ebbf615edd3bb0ec1785be8d
-rwxr-xr-xmeta-phosphor/scripts/run-repotest24
-rw-r--r--meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh14
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh22
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh6
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh2
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh24
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh72
-rw-r--r--meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh8
-rw-r--r--meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh4
-rw-r--r--meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh6
-rw-r--r--meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh10
-rw-r--r--meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh72
-rw-r--r--meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh16
-rw-r--r--meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh6
-rw-r--r--meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh37
-rw-r--r--meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh38
-rw-r--r--meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh17
-rw-r--r--meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh14
-rw-r--r--meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh10
-rw-r--r--meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh2
-rw-r--r--meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh42
-rw-r--r--meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh2
-rwxr-xr-xmeta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh16
-rwxr-xr-xmeta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh2
-rwxr-xr-xmeta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh2
25 files changed, 217 insertions, 251 deletions
diff --git a/meta-phosphor/scripts/run-repotest b/meta-phosphor/scripts/run-repotest
index 27bf738c61..6d6d23ba8a 100755
--- a/meta-phosphor/scripts/run-repotest
+++ b/meta-phosphor/scripts/run-repotest
@@ -129,30 +129,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-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
-meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
-meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
-meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
-meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
-meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
-meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
-meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
-meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
-meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
-meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
-meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh
-meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh
-meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
-meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh
-meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh
-meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh
-meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
-meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh
-meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
-meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
-meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
-meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
"
types=(json shell)
diff --git a/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh b/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh
index ebd6f027ec..8fc28cca77 100644
--- a/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh
+++ b/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh
@@ -6,25 +6,25 @@ host_mac_path="/tmp/usb0_host"
check_usb_local_administered() {
is_enable="$(cat ${mac_config} | grep 'USBLAA')"
- echo ${is_enable}
+ echo "${is_enable}"
}
# Set the locally administered bit (the second least-significant
# bit of the first octet) of the MAC address
set_local_administered_bit() {
- mac="$(tr -d '\0' < $1)"
+ mac="$(tr -d '\0' < "$1")"
first_byte="${mac:0:2}"
first_byte="$((0x$first_byte|2))"
first_byte="$(printf "%02x\n" "$first_byte")"
mac="${first_byte}${mac:2}"
- echo $mac
+ echo "$mac"
}
-cd /sys/kernel/config/usb_gadget
+cd /sys/kernel/config/usb_gadget || exit 1
if [ ! -f "g1" ]; then
mkdir g1
- cd g1
+ cd g1 || exit 1
echo 0x1d6b > idVendor # Linux foundation
echo 0x0104 > idProduct # Multifunction composite gadget
@@ -41,8 +41,8 @@ if [ ! -f "g1" ]; then
if [[ $(check_usb_local_administered) == "USBLAA=true" ]]; then
dev_mac="$(set_local_administered_bit $dev_mac_path)"
host_mac="$(set_local_administered_bit $host_mac_path)"
- echo $dev_mac > $dev_mac_path
- echo $host_mac > $host_mac_path
+ echo "$dev_mac" > $dev_mac_path
+ echo "$host_mac" > $host_mac_path
fi
mkdir -p functions/ecm.usb0
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
index bf71e9452c..32a595f5b1 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-update.sh
@@ -28,14 +28,9 @@ KERNEL_SYSFS_FIU="/sys/bus/platform/drivers/NPCM-FIU"
# the node of FIU is spi for kernel 5.10, but
# for less than or equal kernel 5.4, the node
# is fiu
-for fname in $(find ${KERNEL_SYSFS_FIU} -type l)
-do
- if [ "${fname##*\.}" == "fiu" ]
- then
- KERNEL_FIU_ID="c0000000.fiu"
- break
- fi
-done
+if ls "$KERNEL_SYSFS_FIU"/*.fiu 1> /dev/null 2>&1; then
+ KERNEL_FIU_ID="c0000000.fiu"
+fi
IMAGE_FILE="/tmp/image-bios"
@@ -45,7 +40,7 @@ findmtd() {
m=$(grep -xl "$1" /sys/class/mtd/*/name)
m=${m%/name}
m=${m##*/}
- echo $m
+ echo "$m"
}
cleanup() {
@@ -82,8 +77,7 @@ main() {
exit 1
fi
- flashcp -v $IMAGE_FILE /dev/"${bios_mtd}"
- if [ $? -eq 0 ]; then
+ if flashcp -v $IMAGE_FILE /dev/"${bios_mtd}" ; then
echo "bios update successfully..."
else
echo "bios update failed..."
@@ -91,6 +85,6 @@ main() {
fi
}
# Exit without running main() if sourced
-return 0 2>/dev/null
-
-main "$@"
+if ! (return 0 2>/dev/null); then
+ main "$@"
+fi
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
index 3da25e483d..ac4ee1d577 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bios-update/files/bios-verify.sh
@@ -14,11 +14,11 @@ echo "Verify bios image..."
if [ -e $IMAGE_FILE ] && [ -e $SIG_FILE ];
then
- sha256_image=`sha256sum "$IMAGE_FILE" | awk '{print $1}'`
- sha256_file=`awk '{print $1}' $SIG_FILE`
+ sha256_image=$(sha256sum "$IMAGE_FILE" | awk '{print $1}')
+ sha256_file=$(awk '{print $1}' $SIG_FILE)
fi
-if [[ $sha256_image != $sha256_file ]];
+if [ "$sha256_image" != "$sha256_file" ];
then
echo "bios image verify fail."
rm -f $IMAGE_FILE
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
index bbaf15d7dc..d45105dbec 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-bmc-update/files/bmc-verify.sh
@@ -9,7 +9,7 @@ bmclog="/tmp/update-bmc.log"
if [ -f $publickey ];then
r="$(openssl dgst -verify $publickey -sha256 -signature $sigfile $bmcimage)"
echo "$r" > $bmclog
- if [[ "Verified OK" == "$r" ]]; then
+ if [ "Verified OK" = "$r" ]; then
mv $bmcimage $imagebmc
rm -f $sigfile
exit 0
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
index cb652a2a84..b1bc46e6fd 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-detect-gpio-present/files/detect-gpio-present.sh
@@ -27,24 +27,24 @@ LOG_DEASSERT_FLAG="false"
LOG_GENID_FLAG="0x0020"
present_state=("true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true" "true")
-for i in ${!PRESENT_OBJPATH[@]}
+for i in "${!PRESENT_OBJPATH[@]}"
do
- mapper wait ${PRESENT_OBJPATH[$i]}
+ mapper wait "${PRESENT_OBJPATH[$i]}"
done
while true; do
- for i in ${!PRESENT_OBJPATH[@]}
+ for i in "${!PRESENT_OBJPATH[@]}"
do
- boot_status="$(busctl get-property $SERVICE_NAME ${PRESENT_OBJPATH[$i]} $INTERFACE_NAME Present | awk '{print $2}')"
+ boot_status="$(busctl get-property $SERVICE_NAME "${PRESENT_OBJPATH[$i]}" $INTERFACE_NAME Present | awk '{print $2}')"
- if [ $boot_status == "false" ] && [ ${present_state[$i]} == "true" ];then
- echo "Update cable $(($i+1)) state."
- present_state[$i]="false"
- busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" ${PRESENT_OBJPATH[$i]} $LOG_EVENT_DATA $LOG_ASSERT_FLAG $LOG_GENID_FLAG
- elif [ $boot_status == "true" ] && [ ${present_state[$i]} == "false" ];then
- echo "Update cable $(($i+1)) state."
- present_state[$i]="true"
- busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" ${PRESENT_OBJPATH[$i]} $LOG_EVENT_DATA $LOG_DEASSERT_FLAG $LOG_GENID_FLAG
+ if [ "$boot_status" == "false" ] && [ "${present_state[$i]}" == "true" ];then
+ echo "Update cable $((i+1)) state."
+ present_state[i]="false"
+ busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" "${PRESENT_OBJPATH[$i]}" "$LOG_EVENT_DATA" $LOG_ASSERT_FLAG $LOG_GENID_FLAG
+ elif [ "$boot_status" == "true" ] && [ "${present_state[$i]}" == "false" ];then
+ echo "Update cable $((i+1)) state."
+ present_state[i]="true"
+ busctl call $IPMI_LOG_SERVICE $IPMI_LOG_OBJPATH $IPMI_LOG_INTERFACE $IPMI_LOG_FUNCT $IPMI_LOG_PARA_FORMAT "$LOG_ERR" "${PRESENT_OBJPATH[$i]}" "$LOG_EVENT_DATA" $LOG_DEASSERT_FLAG $LOG_GENID_FLAG
fi
done
sleep 1
diff --git a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
index 8b660c2dca..67636c1924 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-sysinit.sh
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
+# shellcheck source=meta-quanta/meta-gbs/recipes-gbs/gbs-sysinit/files/gbs-gpio-common.sh
source /usr/libexec/gbs-gpio-common.sh
WD1RCR_ADDR=0xf080103c
@@ -44,36 +44,36 @@ set_gpio_persistence() {
}
get_board_rev_id() {
- echo $(get_gpio_value 'BMC_BRD_REV_ID7')\
- $(get_gpio_value 'BMC_BRD_REV_ID6')\
- $(get_gpio_value 'BMC_BRD_REV_ID5')\
- $(get_gpio_value 'BMC_BRD_REV_ID4')\
- $(get_gpio_value 'BMC_BRD_REV_ID3')\
- $(get_gpio_value 'BMC_BRD_REV_ID2')\
- $(get_gpio_value 'BMC_BRD_REV_ID1')\
- $(get_gpio_value 'BMC_BRD_REV_ID0')\
+ echo "$(get_gpio_value 'BMC_BRD_REV_ID7')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID6')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID5')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID4')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID3')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID2')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID1')"\
+ "$(get_gpio_value 'BMC_BRD_REV_ID0')"\
| sed 's/ //g' > ~/board_rev_id.txt
}
get_board_sku_id() {
- echo $(get_gpio_value 'BMC_BRD_SKU_ID3')\
- $(get_gpio_value 'BMC_BRD_SKU_ID2')\
- $(get_gpio_value 'BMC_BRD_SKU_ID1')\
- $(get_gpio_value 'BMC_BRD_SKU_ID0')\
+ echo "$(get_gpio_value 'BMC_BRD_SKU_ID3')"\
+ "$(get_gpio_value 'BMC_BRD_SKU_ID2')"\
+ "$(get_gpio_value 'BMC_BRD_SKU_ID1')"\
+ "$(get_gpio_value 'BMC_BRD_SKU_ID0')"\
| sed 's/ //g' > ~/board_sku_id.txt
}
get_hsbp_board_rev_id() {
- echo $(get_gpio_value 'HSBP_BRD_REV_ID3')\
- $(get_gpio_value 'HSBP_BRD_REV_ID2')\
- $(get_gpio_value 'HSBP_BRD_REV_ID1')\
- $(get_gpio_value 'HSBP_BRD_REV_ID0')\
+ echo "$(get_gpio_value 'HSBP_BRD_REV_ID3')"\
+ "$(get_gpio_value 'HSBP_BRD_REV_ID2')"\
+ "$(get_gpio_value 'HSBP_BRD_REV_ID1')"\
+ "$(get_gpio_value 'HSBP_BRD_REV_ID0')"\
| sed 's/ //g' > ~/hsbp_board_rev_id.txt
}
get_fan_board_rev_id() {
- echo $(get_gpio_value 'FAN_BRD_REV_ID1')\
- $(get_gpio_value 'FAN_BRD_REV_ID0')\
+ echo "$(get_gpio_value 'FAN_BRD_REV_ID1')"\
+ "$(get_gpio_value 'FAN_BRD_REV_ID0')"\
| sed 's/ //g' > ~/fan_board_rev_id.txt
}
@@ -100,10 +100,8 @@ check_board_sku() {
sku1_val=$(get_gpio_value 'BMC_BRD_SKU_ID1')
if (( sku1_val == 1 )); then
echo "GBS SKU!"
- BOARD_SKU="GBS"
else
echo "Other SKU!"
- BOARD_SKU="TBD"
fi
}
@@ -134,11 +132,9 @@ KERNEL_SYSFS_FIU="/sys/bus/platform/drivers/NPCM-FIU"
# the node of FIU is spi for kernel 5.10, but
# for less than or equal kernel 5.4, the node
# is fiu
-shopt -s nullglob
-for fiu in "$KERNEL_SYSFS_FIU"/*.fiu; do
+if ls "$KERNEL_SYSFS_FIU"/*.fiu 1> /dev/null 2>&1; then
KERNEL_FIU_ID="c0000000.fiu"
- break
-done
+fi
bind_host_mtd() {
set_gpio_direction 'SPI_SW_SELECT' high
@@ -162,7 +158,7 @@ findmtd() {
m=$(grep -xl "$1" /sys/class/mtd/*/name)
m=${m%/name}
m=${m##*/}
- echo $m
+ echo "$m"
}
verify_host_bios() {
@@ -176,7 +172,7 @@ verify_host_bios() {
[[ -z "${pnor_mtd}" ]] && { echo "Failed to find host MTD partition!"; return 1; }
# Test timing by computing SHA256SUM.
- sha256sum /dev/${pnor_mtd}ro
+ sha256sum "/dev/${pnor_mtd}ro"
echo "BIOS verification complete!"
unbind_host_mtd
@@ -186,12 +182,12 @@ parse_pe_fru() {
pe_fruid=3
for i in {1..2};
do
- mapper wait ${PE_PRESENT_OBJPATH[$(($i-1))]}
- pe_prsnt_n="$(busctl get-property $SERVICE_NAME ${PE_PRESENT_OBJPATH[$(($i-1))]} \
+ mapper wait "${PE_PRESENT_OBJPATH[$((i-1))]}"
+ pe_prsnt_n="$(busctl get-property $SERVICE_NAME "${PE_PRESENT_OBJPATH[$((i-1))]}" \
$INTERFACE_NAME Present)"
if [[ ${pe_prsnt_n} == "b false" ]]; then
- pe_fruid=$(($pe_fruid+1))
+ pe_fruid=$((pe_fruid+1))
continue
fi
@@ -199,6 +195,7 @@ parse_pe_fru() {
# i2c-0 -> i2c mux (addr: 0x71) -> PE0/PE1
# PE0: channel 0
# PE1: channel 1
+ # shellcheck disable=SC2010
pe_fru_bus="$(ls -al /sys/bus/i2c/drivers/pca954x/0-0071/ | grep channel \
| awk -F "/" '{print $(NF)}' | awk -F "-" '{print $2}' | sed -n "${i}p")"
@@ -206,17 +203,16 @@ parse_pe_fru() {
# EEPROM part number) and perform a phosphor-read-eeprom
for ((j=0; j < ${#pe_eeprom_addr[@]}; j++));
do
- i2cget -f -y $pe_fru_bus "0x${pe_eeprom_addr[$j]}" 0x01 > /dev/null 2>&1
- if [ $? -eq 0 ]; then
+ if i2cget -f -y "$pe_fru_bus" "0x${pe_eeprom_addr[$j]}" 0x01 > /dev/null 2>&1 ; then
if [ ! -f "/sys/bus/i2c/devices/$pe_fru_bus-00${pe_eeprom_addr[$j]}/eeprom" ]; then
echo 24c02 "0x${pe_eeprom_addr[$j]}" > "/sys/bus/i2c/devices/i2c-$pe_fru_bus/new_device"
fi
pe_fru_bus="/sys/bus/i2c/devices/$pe_fru_bus-00${pe_eeprom_addr[$j]}/eeprom"
- phosphor-read-eeprom --eeprom $pe_fru_bus --fruid $pe_fruid
+ phosphor-read-eeprom --eeprom "$pe_fru_bus" --fruid $pe_fruid
break
fi
done
- pe_fruid=$(($pe_fruid+1))
+ pe_fruid=$((pe_fruid+1))
done
}
@@ -224,7 +220,7 @@ check_power_status() {
res0="$(busctl get-property -j xyz.openbmc_project.State.Chassis \
/xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis \
CurrentPowerState | jq -r '.["data"]')"
- echo $res0
+ echo "$res0"
}
clk_buf_bus_switch="11-0076"
@@ -277,6 +273,6 @@ main() {
}
# Exit without running main() if sourced
-return 0 2>/dev/null
-
-main "$@"
+if ! (return 0 2>/dev/null) ; then
+ main "$@"
+fi
diff --git a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
index e22dd20438..14136b7669 100644
--- a/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
+++ b/meta-quanta/meta-gbs/recipes-gbs/hotswap-power-cycle/files/tray_powercycle.sh
@@ -27,12 +27,12 @@ stop_phosphor_hwmon() {
main() {
# Stop phosphor-hwmon so that ADM1272 powercycle doesn't happen
# in the middle of an i2c transaction and stuck the bus low
- stop_phosphor_hwmon
+ stop_phosphor_hwmon "$@"
gpioset gpiochip6 26=1
}
# Exit without running main() if sourced
-return 0 2>/dev/null
-
-main "$@"
+if ! (return 0 2>/dev/null) ; then
+ main "$@"
+fi
diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
index 1bff18d081..97f9cfe57a 100644
--- a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
+++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-check-host-state.sh
@@ -5,8 +5,8 @@ state="xyz.openbmc_project.State.Chassis.PowerState.Off"
dbus-monitor --system type='signal',interface='org.freedesktop.DBus.Properties',\
member='PropertiesChanged',arg0namespace='xyz.openbmc_project.State.Chassis' | \
while read -r line; do
- grep -q member <<< $line && continue
- if grep -q $state <<< $line; then
+ grep -q member <<< "$line" && continue
+ if grep -q $state <<< "$line"; then
echo "Setting failsafe assuming host is off" >&2
systemctl start --no-block gbs-host-s5-set-failsafe
fi
diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
index bcd1d2cc21..8d6f774c84 100644
--- a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
+++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon/gbs-set-failsafe.sh
@@ -22,10 +22,10 @@ if [ -z "$target_pwm" ]; then
exit 1
fi
-zone_num="$(busctl tree xyz.openbmc_project.State.FanCtrl | grep zone | wc -l)"
+zone_num="$(busctl tree xyz.openbmc_project.State.FanCtrl | grep -c zone)"
result=0
-for (( i = 0; i < ${zone_num}; i++ )); do
+for (( i = 0; i < zone_num; i++ )); do
retries=4
busctl_error=-1
@@ -39,7 +39,7 @@ for (( i = 0; i < ${zone_num}; i++ )); do
sleep 1
fi
- let retries-=1
+ (( retries-=1 )) || true
done
if (( busctl_error != 0 )); then
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
index 5ceac7ea5f..427c98e9a0 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
@@ -12,29 +12,29 @@ mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan1
mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan2
# generate fan table writePath
-Fan_0_To_4_Hwmon="$(ls /sys/devices/platform/ahb/ahb\:*/*pwm-fan-controller/hwmon/)"
+Fan_0_To_4_Hwmon="$(ls /sys/devices/platform/ahb/ahb:*/*pwm-fan-controller/hwmon/)"
if [[ "$Fan_0_To_4_Hwmon" != "" ]]; then
- sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" $TEMP_FILE
+ sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" "$TEMP_FILE"
fi
presentGpio=()
presentState=()
gpioPath="/sys/class/gpio/gpio"
if [[ -f "/etc/nvme/nvme_config.json" ]]; then
- presentGpio=($(cat /etc/nvme/nvme_config.json | grep NVMeDrivePresentPin \
+ # shellcheck disable=SC2207
+ presentGpio=($(grep NVMeDrivePresentPin /etc/nvme/nvme_config.json \
| awk '{print $2}' | cut -d "," -f 0))
fi
nvmePath="/xyz/openbmc_project/sensors/temperature/nvme"
-nvmeInventoryPath="/xyz/openbmc_project/inventory/system/chassis/motherboard/nvme"
# Get and Set WCTEMP
for ((i = 0; i < 16; i++)); do
name="@WCTemp$(printf "%02d" $i)@"
wcTemp=72000
if [[ -d "${gpioPath}${presentGpio[i]}" ]] &&
- [[ "$(cat ${gpioPath}${presentGpio[i]}/value)" == "0" ]]; then
+ [[ "$(cat "${gpioPath}${presentGpio[i]}/value")" == "0" ]]; then
presentState[i]="true"
else
presentState[i]="false"
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
index c8e328ac62..323be60064 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
+++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
@@ -4,7 +4,7 @@ TARGET_FILE_NAME="/etc/nvme/nvme_config.json"
export_gpio() {
if [ ! -d "/sys/class/gpio/gpio$1" ]; then
- echo $1 >/sys/class/gpio/export
+ echo "$1" >/sys/class/gpio/export
fi
}
@@ -18,8 +18,7 @@ if [ -d "/sys/bus/i2c/drivers/pca953x/1-0024" ]; then
presentPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0024/gpio/gpiochip*/base)"
for i in {0..15};
do
- let presentPinBase[$i]=presentPinBase+$i
- export_gpio ${presentPinBase[$i]}
+ export_gpio $(( presentPinBase + i ))
done
else
echo "Can't find present gpio expander (addr: 0x24) !!"
@@ -29,8 +28,7 @@ if [ -d "/sys/bus/i2c/drivers/pca953x/1-0021" ]; then
PwrGoodPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0021/gpio/gpiochip*/base)"
for i in {0..15};
do
- let PwrGoodPinBase[$i]=PwrGoodPinBase+$i
- export_gpio ${PwrGoodPinBase[$i]}
+ export_gpio $(( PwrGoodPinBase + i ))
done
else
echo "Can't find powergood gpio expander (addr: 0x21) !!"
@@ -46,8 +44,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate",
- "NVMeDrivePresentPin": ${presentPinBase[3]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[3]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 3)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 3))
},
{
"NVMeDriveIndex": 1,
@@ -56,8 +54,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate",
- "NVMeDrivePresentPin": ${presentPinBase[2]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[2]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 2)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 2))
},
{
"NVMeDriveIndex": 2,
@@ -66,8 +64,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate",
- "NVMeDrivePresentPin": ${presentPinBase[1]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[1]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 1)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 1))
},
{
"NVMeDriveIndex": 3,
@@ -76,8 +74,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate",
- "NVMeDrivePresentPin": ${presentPinBase[0]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[0]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 0)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 0))
},
{
"NVMeDriveIndex": 4,
@@ -86,8 +84,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate",
- "NVMeDrivePresentPin": ${presentPinBase[7]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[7]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 7)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 7))
},
{
"NVMeDriveIndex": 5,
@@ -96,8 +94,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate",
- "NVMeDrivePresentPin": ${presentPinBase[6]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[6]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 6)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 6))
},
{
"NVMeDriveIndex": 6,
@@ -106,8 +104,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate",
- "NVMeDrivePresentPin": ${presentPinBase[5]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[5]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 5)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 5))
},
{
"NVMeDriveIndex": 7,
@@ -116,8 +114,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate",
- "NVMeDrivePresentPin": ${presentPinBase[4]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[4]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 4)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 4))
},
{
"NVMeDriveIndex": 8,
@@ -126,8 +124,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate",
- "NVMeDrivePresentPin": ${presentPinBase[11]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[11]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 11)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 11))
},
{
"NVMeDriveIndex": 9,
@@ -136,8 +134,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate",
- "NVMeDrivePresentPin": ${presentPinBase[10]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[10]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 10)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 10))
},
{
"NVMeDriveIndex": 10,
@@ -146,8 +144,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate",
- "NVMeDrivePresentPin": ${presentPinBase[9]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[9]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 9)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 9))
},
{
"NVMeDriveIndex": 11,
@@ -156,8 +154,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate",
- "NVMeDrivePresentPin": ${presentPinBase[8]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[8]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 8)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 8))
},
{
"NVMeDriveIndex": 12,
@@ -166,8 +164,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate",
- "NVMeDrivePresentPin": ${presentPinBase[15]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[15]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 15)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 15))
},
{
"NVMeDriveIndex": 13,
@@ -176,8 +174,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate",
- "NVMeDrivePresentPin": ${presentPinBase[14]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[14]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 14)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 14))
},
{
"NVMeDriveIndex": 14,
@@ -186,8 +184,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate",
- "NVMeDrivePresentPin": ${presentPinBase[13]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[13]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 13)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 13))
},
{
"NVMeDriveIndex": 15,
@@ -196,8 +194,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate",
- "NVMeDrivePresentPin": ${presentPinBase[12]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[12]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 12)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 12))
}
],
"threshold": [
diff --git a/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh b/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
index 80f1f69c55..20cdd6dec8 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/detect-fan-fail/files/detect-fan-fail.sh
@@ -3,14 +3,14 @@
# get fan state by d-bus command
function get_fan_state() {
get_property_path='xyz.openbmc_project.Sensor.Threshold.Critical CriticalAlarmLow'
- fan_state="$(busctl get-property $1 $2 $get_property_path | awk '{print $2}')"
+ fan_state="$(busctl get-property "$1" "$2" "$get_property_path" | awk '{print $2}')"
echo "$fan_state"
}
# set fan pwm by d-bus command
function set_fan_value() {
set_property_path='xyz.openbmc_project.Control.FanPwm'
- busctl set-property $1 $2 $set_property_path Target t 255
+ busctl set-property "$1" "$2" $set_property_path Target t 255
}
fan_tach_path=( '/xyz/openbmc_project/sensors/fan_tach/Fan0_0_RPM'
@@ -24,10 +24,10 @@ fan_tach_path=( '/xyz/openbmc_project/sensors/fan_tach/Fan0_0_RPM'
check_fail_flag=0
current_fan_state=()
while true; do
- hwmon_path="$(mapper get-service ${fan_tach_path[0]})"
- for i in ${!fan_tach_path[@]};
+ hwmon_path="$(mapper get-service "${fan_tach_path[0]}")"
+ for i in "${!fan_tach_path[@]}";
do
- current_fan_state[$i%2]=$(get_fan_state $hwmon_path ${fan_tach_path[$i]})
+ current_fan_state[i%2]=$(get_fan_state "$hwmon_path" "${fan_tach_path[$i]}")
#Compare state of dual rotors with CriticalAlarmLow to check if fan fail
if [ ${#current_fan_state[@]} -eq 2 ];then
@@ -35,10 +35,10 @@ while true; do
[ "${current_fan_state[1]}" == "true" ] ;then
if [ $check_fail_flag -eq 0 ];then
systemctl stop phosphor-pid-control
- for j in ${!fan_tach_path[@]};
+ for j in "${!fan_tach_path[@]}";
do
#If fan fail is detect, set other fan rpm to pwm 255.
- set_fan_value $hwmon_path ${fan_tach_path[$j]}
+ set_fan_value "$hwmon_path" "${fan_tach_path[$j]}"
check_fail_flag=1
done
fi
@@ -49,7 +49,7 @@ while true; do
fi
#fans are going to normal.
- if [ $i -eq $((${#fan_tach_path[@]}-1)) ] && [ $check_fail_flag -eq 1 ]; then
+ if [ "$i" -eq $((${#fan_tach_path[@]}-1)) ] && [ $check_fail_flag -eq 1 ]; then
check_fail_flag=0
systemctl restart phosphor-pid-control
fi
diff --git a/meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh b/meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh
index bed745dda3..118fe6cc94 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/gsj-hotswap-change-setting/files/gsj-hotswap-change-setting.sh
@@ -17,7 +17,7 @@ function set_hotswap_reg()
function get_hotswap_value()
{
#get the value of reg "0xd9", return value should be "0x08"
- echo "$(i2cget -f -y $I2C_BUS $CHIP_ADDR 0xd9)"
+ i2cget -f -y $I2C_BUS $CHIP_ADDR 0xd9
}
function export_gpio()
@@ -32,7 +32,7 @@ function export_gpio()
function get_gpio_value()
{
- echo "$(cat $GPIO_BasePath/gpio$GPIO_ID/value)"
+ cat $GPIO_BasePath/gpio$GPIO_ID/value
}
function setting_hotswap()
@@ -64,4 +64,4 @@ if [ "$gpio_value" == "1" ];then
setting_hotswap
else
echo "gpio$GPIO_ID value is: $gpio_value, no need to set hotswap."
-fi \ No newline at end of file
+fi
diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh
index 08aa7a0549..c6485a4f63 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/init_once.sh
@@ -1,58 +1,59 @@
#!/bin/bash
+# shellcheck source=meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
source /usr/libexec/nvme_powerctrl_library.sh
function set_gpio() {
#$1 gpio pin
- echo $1 > /sys/class/gpio/export
+ echo "$1" > /sys/class/gpio/export
}
echo "Read Clock Gen Value is: $CLOCK_GEN_VALUE"
## Initial U2_PRESENT_N
-for i in ${!U2_PRESENT[@]};
+for i in "${!U2_PRESENT[@]}";
do
- set_gpio ${U2_PRESENT[$i]};
- set_gpio_direction ${U2_PRESENT[$i]} 'in';
- echo "Read $i SSD present: $(read_gpio_input ${U2_PRESENT[$i]})"
+ set_gpio "${U2_PRESENT[$i]}";
+ set_gpio_direction "${U2_PRESENT[$i]}" 'in';
+ echo "Read $i SSD present: $(read_gpio_input "${U2_PRESENT[$i]}")"
done
## Initial POWER_U2_EN
-for i in ${!POWER_U2[@]};
+for i in "${!POWER_U2[@]}";
do
- set_gpio ${POWER_U2[$i]};
+ set_gpio "${POWER_U2[$i]}";
done
## Initial PWRGD_U2
-for i in ${!PWRGD_U2[@]};
+for i in "${!PWRGD_U2[@]}";
do
- set_gpio ${PWRGD_U2[$i]};
- set_gpio_direction ${PWRGD_U2[$i]} 'in';
- echo "Read $i SSD Power Good: $(read_gpio_input ${PWRGD_U2[$i]})"
+ set_gpio "${PWRGD_U2[$i]}";
+ set_gpio_direction "${PWRGD_U2[$i]}" 'in';
+ echo "Read $i SSD Power Good: $(read_gpio_input "${PWRGD_U2[$i]}")"
done
## Initial RST_BMC_U2
-for i in ${!RST_BMC_U2[@]};
+for i in "${!RST_BMC_U2[@]}";
do
- set_gpio ${RST_BMC_U2[$i]};
+ set_gpio "${RST_BMC_U2[$i]}";
done
### Initial related Power by Present
for i in {0..7};
do
- update_value=$(printf '%x\n' "$((0x01 <<$i))")
- if [ $(read_gpio_input ${U2_PRESENT[$i]}) == $PLUGGED ];then
+ update_value=$(printf '%x\n' "$((0x01 << i))")
+ if [ "$(read_gpio_input "${U2_PRESENT[$i]}")" == $PLUGGED ];then
CLOCK_GEN_VALUE=$(printf '0x%x\n' \
- "$(($CLOCK_GEN_VALUE | 0x$update_value))")
+ "$((CLOCK_GEN_VALUE | 0x$update_value))")
else
set_gpio_direction "${RST_BMC_U2[$i]}" "low"
set_gpio_direction "${POWER_U2[$i]}" "low"
CLOCK_GEN_VALUE=$(printf '0x%x\n' \
- "$(($CLOCK_GEN_VALUE & ~0x$update_value))")
+ "$((CLOCK_GEN_VALUE & ~0x$update_value))")
fi
done
-i2cset -y $I2C_BUS $CHIP_ADDR 0 $CLOCK_GEN_VALUE s
+i2cset -y $I2C_BUS $CHIP_ADDR 0 "$CLOCK_GEN_VALUE" s
echo "Read Clock Gen Value again is: $CLOCK_GEN_VALUE"
exit 0;
diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
index 3737aacc10..0ee436debd 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
@@ -1,42 +1,44 @@
#!/bin/bash
-U2_PRESENT=( 148 149 150 151 152 153 154 155 )
-POWER_U2=( 195 196 202 199 198 197 127 126 )
-PWRGD_U2=( 161 162 163 164 165 166 167 168 )
-RST_BMC_U2=( 72 73 74 75 76 77 78 79 )
-PLUGGED=0
-I2C_BUS=8
-CHIP_ADDR=0x68
+export U2_PRESENT=( 148 149 150 151 152 153 154 155 )
+export POWER_U2=( 195 196 202 199 198 197 127 126 )
+export PWRGD_U2=( 161 162 163 164 165 166 167 168 )
+export RST_BMC_U2=( 72 73 74 75 76 77 78 79 )
+export PLUGGED=0
+export I2C_BUS=8
+export CHIP_ADDR=0x68
+export CLOCK_GEN_VALUE=
+
CLOCK_GEN_VALUE=$(i2cget -y $I2C_BUS $CHIP_ADDR 0 i 2|cut -f3 -d' ')
function set_gpio_direction()
{
#$1 gpio pin, $2 'in','high','low'
- echo $2 > /sys/class/gpio/gpio$1/direction
+ echo "$2" > "/sys/class/gpio/gpio$1/direction"
}
function read_gpio_input()
{
#$1 read input gpio pin
- echo $(cat /sys/class/gpio/gpio$1/value)
+ cat "/sys/class/gpio/gpio$1/value"
}
function enable_nvme_power()
{
set_gpio_direction "${POWER_U2[$1]}" "high"
sleep 0.04
- check_powergood $1
+ check_powergood "$1"
}
function check_powergood()
{
- if [ $(read_gpio_input ${PWRGD_U2[$1]}) == 1 ];then
+ if [ "$(read_gpio_input "${PWRGD_U2[$1]}")" == 1 ];then
sleep 0.005
- update_clock_gen_chip_register $1 1
+ update_clock_gen_chip_register "$1" 1
sleep 0.1
set_gpio_direction "${RST_BMC_U2[$1]}" "high"
else
- disable_nvme_power $1
+ disable_nvme_power "$1"
fi
}
@@ -44,7 +46,7 @@ function disable_nvme_power()
{
set_gpio_direction "${RST_BMC_U2[$1]}" "low"
sleep 0.1
- update_clock_gen_chip_register $1 0
+ update_clock_gen_chip_register "$1" 0
sleep 0.005
set_gpio_direction "${POWER_U2[$1]}" "low"
}
@@ -52,12 +54,12 @@ function disable_nvme_power()
function update_clock_gen_chip_register(){
#$1 nvme slot number, $2 enable/disable
update_value=$(printf '%x\n' "$((0x01 <<$1))")
- if [ $2 -eq 1 ];then
+ if [ "$2" -eq 1 ];then
CLOCK_GEN_VALUE=$(printf '0x%x\n' \
- "$(($CLOCK_GEN_VALUE | 0x$update_value))")
+ "$((CLOCK_GEN_VALUE | 0x$update_value))")
else
CLOCK_GEN_VALUE=$(printf '0x%x\n' \
- "$(($CLOCK_GEN_VALUE & ~0x$update_value))")
+ "$((CLOCK_GEN_VALUE & ~0x$update_value))")
fi
- i2cset -y $I2C_BUS $CHIP_ADDR 0 $CLOCK_GEN_VALUE s
+ i2cset -y $I2C_BUS $CHIP_ADDR 0 "$CLOCK_GEN_VALUE" s
}
diff --git a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh
index 753c6c4cf5..d6d9aa66f9 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powermanager.sh
@@ -1,5 +1,6 @@
#!/bin/bash
+# shellcheck source=meta-quanta/meta-gsj/recipes-gsj/quanta-nvme-powerctrl/files/nvme_powerctrl_library.sh
source /usr/libexec/nvme_powerctrl_library.sh
U2_PRESENT_STATUS=( 1 1 1 1 1 1 1 1 )
@@ -9,14 +10,14 @@ function recovery_power()
sleep 0.2
set_gpio_direction "${POWER_U2[$1]}" "high"
sleep 0.2
- check_powergood $1
+ check_powergood "$1"
}
##Initial U2 present status
for i in {0..7};
do
- U2_PRESENT_STATUS[$i]=$(read_gpio_input ${U2_PRESENT[$i]})
+ U2_PRESENT_STATUS[i]=$(read_gpio_input "${U2_PRESENT[$i]}")
done
## Loop while
@@ -26,21 +27,21 @@ do
do
## 1 second scan all loop
sleep 0.125
- read_present=$(read_gpio_input ${U2_PRESENT[$i]})
+ read_present=$(read_gpio_input "${U2_PRESENT[$i]}")
if [ "$read_present" != "${U2_PRESENT_STATUS[$i]}" ];then
- U2_PRESENT_STATUS[$i]="$read_present"
+ U2_PRESENT_STATUS[i]="$read_present"
if [ "$read_present" == $PLUGGED ];then
echo "NVME $i Enable Power"
- enable_nvme_power $i
+ enable_nvme_power "$i"
else
echo "NVME $i Disable Power"
- disable_nvme_power $i
+ disable_nvme_power "$i"
fi
else
if [ "${U2_PRESENT_STATUS[$i]}" == $PLUGGED ] &&
- [ $(read_gpio_input ${PWRGD_U2[$i]}) == 0 ];then
+ [ "$(read_gpio_input "${PWRGD_U2[$i]}")" == 0 ];then
echo "NVME $i Recovery Power"
- recovery_power $i
+ recovery_power "$i"
fi
fi
done
diff --git a/meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh b/meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh
index 45fa888bea..1a27d90a9d 100644
--- a/meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh
+++ b/meta-quanta/meta-gsj/recipes-gsj/usb-network/files/usb_network.sh
@@ -1,26 +1,26 @@
#!/bin/bash
-cd /sys/kernel/config/usb_gadget
+cd /sys/kernel/config/usb_gadget || exit
if [ ! -f "g1" ]; then
mkdir g1
- cd g1
+ cd g1 || exit
echo 0x1d6b > idVendor # Linux foundation
echo 0x0104 > idProduct # Multifunction composite gadget
mkdir -p strings/0x409
echo "Linux" > strings/0x409/manufacturer
echo "Ethernet/RNDIS gadget" > strings/0x409/product
-
+
mkdir -p configs/c.1
echo 100 > configs/c.1/MaxPower
mkdir -p configs/c.1/strings/0x409
echo "RNDIS" > configs/c.1/strings/0x409/configuration
-
- mkdir -p functions/rndis.usb0
-
+
+ mkdir -p functions/rndis.usb0
+
ln -s functions/rndis.usb0 configs/c.1
-
+
echo f0839000.udc > UDC
fi
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh
index 3c84ce4188..afad9db4b3 100644
--- a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-control.sh
@@ -10,29 +10,29 @@ TYPE=-1
for i in {0..7}
do
gpioNum=${NVME_GPIO_NUM[$i]}
- NVME[$i]=$(cat /sys/class/gpio/gpio$gpioNum/value)
+ NVME[i]=$(cat "/sys/class/gpio/gpio$gpioNum/value")
done
# distinguish between 8-ssd and 2-ssd sku
for i in {2..7}
do
- if [ ${NVME[$i]} -eq 0 ]; then
+ if [ "${NVME[$i]}" -eq 0 ]; then
TYPE=0
fi
done
if [ $TYPE -eq -1 ]; then
for i in {0..1}
do
- if [ ${NVME[$i]} -eq 0 ]; then
+ if [ "${NVME[$i]}" -eq 0 ]; then
TYPE=1
fi
done
fi
if [ $TYPE -eq 1 ]; then
- cp ${FAN_TABLE[1]} $FAN_TABLE_PATH
+ cp "${FAN_TABLE[1]}" $FAN_TABLE_PATH
else
- cp ${FAN_TABLE[0]} $FAN_TABLE_PATH
+ cp "${FAN_TABLE[0]}" $FAN_TABLE_PATH
fi
# start pid control
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
index 2cd31066c6..f119432967 100644
--- a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
@@ -1,4 +1,4 @@
-#!bin/bash
+#!/bin/bash
echo 230 > /sys/class/hwmon/*/pwm1
echo 230 > /sys/class/hwmon/*/pwm2
diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh
index 04b447615a..caceb5f788 100644
--- a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh
+++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh
@@ -2,19 +2,19 @@
string=''
pmbus_read() {
- data=$(i2cget -f -y $1 $2 $3 i $4)
+ data=$(i2cget -f -y "$1" "$2" "$3" i "$4")
if [[ -z "$data" ]]; then
echo "i2c$1 device $2 command $3 error" >&2
exit 1
fi
- arry=$(echo ${data} | sed -e "s/$4\: //" | sed -e "s/\0x00//g" | sed -e "s/\0xff//g" | sed -e "s/\0x7f//g" | sed -e "s/\0x0f//g" | sed -e "s/\0x14//g")
+ arry=$(echo "${data}" | sed -e "s/$4\: //" | sed -e "s/\0x00//g" | sed -e "s/\0xff//g" | sed -e "s/\0x7f//g" | sed -e "s/\0x0f//g" | sed -e "s/\0x14//g")
string=''
for d in ${arry}
do
- hex=$(echo $d | sed -e "s/0\x//")
+ hex=${d/0x}
string+=$(echo -e "\x${hex}");
done
}
@@ -28,9 +28,9 @@ update_inventory() {
${INVENTORY_SERVICE} \
${INVENTORY_OBJECT} \
${INVENTORY_PATH} \
- Notify a{oa{sa{sv}}} 1 \
- ${OBJECT_PATH} 1 $2 $3 \
- $4 $5 $6
+ Notify "a{oa{sa{sv}}}" 1 \
+ "${OBJECT_PATH}" 1 "$2" "$3" \
+ "$4" "$5" "$6"
}
if [ $# -eq 0 ]; then
@@ -38,24 +38,22 @@ if [ $# -eq 0 ]; then
exit 1
fi
-input=$(echo $1 | tr "-" " ")
-arr=(${input// / });
+IFS=" " read -ra arr <<< "${1//- /}"
+pmbus_read "${arr[1]}" "${arr[2]}" 0x99 11
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "Manufacturer" "s" "$string"
-pmbus_read ${arr[1]} ${arr[2]} 0x99 11
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "Manufacturer" "s" $string
+pmbus_read "${arr[1]}" "${arr[2]}" 0x9a 11
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "Model" "s" "$string"
-pmbus_read ${arr[1]} ${arr[2]} 0x9a 11
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "Model" "s" $string
+pmbus_read "${arr[1]}" "${arr[2]}" 0xad 21
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "PartNumber" "s" "$string"
-pmbus_read ${arr[1]} ${arr[2]} 0xad 21
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "PartNumber" "s" $string
+pmbus_read "${arr[1]}" "${arr[2]}" 0x9e 18
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "SerialNumber" "s" "$string"
-pmbus_read ${arr[1]} ${arr[2]} 0x9e 18
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "SerialNumber" "s" $string
-
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Cacheable" 1 "Cached" "b" "true"
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Replaceable" 1 "FieldReplaceable" "b" "true"
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Item" 1 "Present" "b" "true"
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Item" 1 "PrettyName" "s" "powersupply${arr[0]}"
-update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Item.PowerSupply" 0
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Decorator.Cacheable" 1 "Cached" "b" "true"
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Decorator.Replaceable" 1 "FieldReplaceable" "b" "true"
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Item" 1 "Present" "b" "true"
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Item" 1 "PrettyName" "s" "powersupply${arr[0]}"
+update_inventory "${arr[0]}" "xyz.openbmc_project.Inventory.Item.PowerSupply" 0
diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh b/meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
index 9a0d8e2e7d..243823ae04 100644
--- a/meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
+++ b/meta-quanta/meta-olympus-nuvoton/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
@@ -1,3 +1,3 @@
-#!bin/bash
+#!/bin/bash
echo 255 > /sys/class/hwmon/*/pwm1
diff --git a/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh b/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
index 205ecaff0f..08b288083f 100755
--- a/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
+++ b/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/init_once.sh
@@ -7,26 +7,26 @@ function set_gpio_active_low() {
return;
fi
- echo $1 > /sys/class/gpio/export
- echo 1 > /sys/class/gpio/gpio$1/active_low
- echo $2 > /sys/class/gpio/gpio$1/direction
+ echo "$1" > /sys/class/gpio/export
+ echo 1 > "/sys/class/gpio/gpio$1/active_low"
+ echo "$2" > "/sys/class/gpio/gpio$1/direction"
}
GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
# FM_BMC_READY_N, GPIO Q4, active low
-set_gpio_active_low $((${GPIO_BASE} + 128 + 4)) high
+set_gpio_active_low $((GPIO_BASE + 128 + 4)) high
# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
-set_gpio_active_low $((${GPIO_BASE} + 128 + 6)) high
+set_gpio_active_low $((GPIO_BASE + 128 + 6)) high
# FM_BMC_SYS_THROTTLE_N, GPIO A3, active low
-set_gpio_active_low $((${GPIO_BASE} + 0 + 3)) high
+set_gpio_active_low $((GPIO_BASE + 0 + 3)) high
# FM_BMC_SSB_SCI_LPC_N, GPIO E4, active low
-set_gpio_active_low $((${GPIO_BASE} + 32 + 4)) high
+set_gpio_active_low $((GPIO_BASE + 32 + 4)) high
# FP_PWR_BTN_PASS_R_N, GPIO D3, active low
-set_gpio_active_low $((${GPIO_BASE} + 24 + 3)) high
+set_gpio_active_low $((GPIO_BASE + 24 + 3)) high
exit 0;
diff --git a/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh b/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
index 8e0dae38c2..5049f41f30 100755
--- a/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
+++ b/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweroff.sh
@@ -1,7 +1,7 @@
#!/bin/bash
GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
-GPIO_NUM=$(($GPIO_BASE + 24 + 3))
+GPIO_NUM=$((GPIO_BASE + 24 + 3))
echo 1 > /sys/class/gpio/gpio${GPIO_NUM}/value
sleep 5
diff --git a/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh b/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
index f925a33a8c..2ae70de350 100755
--- a/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
+++ b/meta-quanta/meta-q71l/recipes-phosphor/quanta-powerctrl/files/poweron.sh
@@ -1,7 +1,7 @@
#!/bin/bash
GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
-GPIO_NUM=$(($GPIO_BASE + 24 + 3))
+GPIO_NUM=$((GPIO_BASE + 24 + 3))
echo 1 > /sys/class/gpio/gpio${GPIO_NUM}/value
sleep 1