summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-common
diff options
context:
space:
mode:
authorThang Q. Nguyen <thang@os.amperecomputing.com>2021-11-04 11:30:27 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2021-11-04 16:10:58 +0300
commitdde1fede1f832f029742a1d27290cfe252ab1bc5 (patch)
treed8e4bbb3ee309dbcc4324a98682bbf444bbe8ca2 /meta-ampere/meta-common
parent5a5f33c729e6b5869362172b63595422eb84a418 (diff)
downloadopenbmc-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-common')
-rwxr-xr-xmeta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh37
1 files changed, 17 insertions, 20 deletions
diff --git a/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh
index af3e2bead..cc39f30fc 100755
--- a/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh
+++ b/meta-ampere/meta-common/recipes-phosphor/flash/phosphor-software-manager/firmware_update.sh
@@ -21,31 +21,29 @@
usage () {
echo "Usage:"
- echo " $(basename $0) <image path> "
+ echo " $(basename "$0") <image path> "
echo "Where:"
echo " <image path>: the path link to folder, which include image file and MANIFEST"
echo "Example:"
- echo " $(basename $0) /tmp/images/ghdh1393"
+ echo " $(basename "$0") /tmp/images/ghdh1393"
}
IMG_PATH="$1"
-if [ ! -d $IMG_PATH ]; then
- echo $IMG_PATH
+if [ ! -d "$IMG_PATH" ]; then
echo "The folder $IMG_PATH does not exist"
usage
exit 1
fi
MANIFEST_PATH="${IMG_PATH}/MANIFEST"
-if [ ! -f $MANIFEST_PATH ]; then
- echo $MANIFEST_PATH
+if [ ! -f "$MANIFEST_PATH" ]; then
echo "The MANIFEST file $MANIFEST_PATH does not exist"
usage
exit 1
fi
-EXTENDED_VERSION=$(awk '/ExtendedVersion/ {print}' ${MANIFEST_PATH} | cut -d "=" -f 2)
+EXTENDED_VERSION=$(awk '/ExtendedVersion/ {print}' "${MANIFEST_PATH}" | cut -d "=" -f 2)
# If the ExtendedVersion is empty, set default to update UEFI/EDKII on primary device
if [ -z "$EXTENDED_VERSION" ]
@@ -56,28 +54,28 @@ fi
# Assign the command based on the ExtendedVersion
case ${EXTENDED_VERSION} in
"primary")
- export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \))
- export CMD='/usr/sbin/ampere_flash_bios.sh $IMAGE 1'
+ IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \))
+ CMD="/usr/sbin/ampere_flash_bios.sh $IMAGE 1"
;;
"secondary")
- export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \))
- export CMD='/usr/sbin/ampere_flash_bios.sh $IMAGE 2'
+ IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.bin" -o -name "*.rom" \))
+ CMD="/usr/sbin/ampere_flash_bios.sh $IMAGE 2"
;;
"scp-primary")
- export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \))
- export CMD='/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 1'
+ IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \))
+ CMD="/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 1"
;;
"scp-secondary")
- export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \))
- export CMD='/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 2'
+ IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.img" -o -name "*.slim" -o -name "*.rom" \))
+ CMD="/usr/sbin/ampere_firmware_upgrade.sh smpmpro $IMAGE 2"
;;
"fru")
- export IMAGE=$(find ${IMG_PATH} -type f \( -name "*.bin" \))
- export CMD='/usr/sbin/ampere_firmware_upgrade.sh fru $IMAGE'
+ IMAGE=$(find "${IMG_PATH}" -type f \( -name "*.bin" \))
+ CMD="/usr/sbin/ampere_firmware_upgrade.sh fru $IMAGE"
;;
*)
@@ -91,11 +89,10 @@ if [ -z "$IMAGE" ]
then
echo "ERROR: The image file: No such file or directory"
exit 1
-else
- eval $CMD
fi
-if [[ $? -ne 0 ]]; then
+if ! eval "$CMD";
+then
echo "ERROR: The firmware update not successfull"
exit 1
fi