meta-quanta: fix shellcheck issues
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I189baf142cc86d44ebbf615edd3bb0ec1785be8d
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 bf71e94..32a595f 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 @@
# 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 @@
m=$(grep -xl "$1" /sys/class/mtd/*/name)
m=${m%/name}
m=${m##*/}
- echo $m
+ echo "$m"
}
cleanup() {
@@ -82,8 +77,7 @@
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 @@
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 3da25e4..ac4ee1d 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 @@
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