meta-phosphor: phosphor-mmc-init: fix shellcheck
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1f668e1e40c937e016c60af13705ea60936ed739
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh
index 316bffc..cc1c0dd 100644
--- a/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-init.sh
@@ -2,9 +2,9 @@
# Get the value of the root env variable found in /proc/cmdline
get_root() {
- local cmdline="$(cat /proc/cmdline)"
+ _cmdline="$(cat /proc/cmdline)"
root=
- for opt in $cmdline
+ for opt in $_cmdline
do
case $opt in
root=PARTLABEL=*)
@@ -14,7 +14,7 @@
;;
esac
done
- [ -n "$root" ] && echo $root
+ [ -n "$root" ] && echo "$root"
}
fslist="proc sys dev run"
@@ -23,7 +23,7 @@
rwfsdev="/dev/disk/by-partlabel/rwfs"
cd /
-mkdir -p $fslist
+mkdir -p "$fslist"
mount dev dev -tdevtmpfs
mount sys sys -tsysfs
mount proc proc -tproc
@@ -48,7 +48,7 @@
fi
# There eMMC GPT labels for the rootfs are rofs-a and rofs-b, and the label for
-# the read-write partition is rwfs. Run udev to make the partition labels show
+# the read-write partition is rwfs. Run udev to make the partition labels show
# up. Mounting by label allows for partition numbers to change if needed.
udevd --daemon
udevadm trigger --type=devices --action=add
@@ -62,25 +62,24 @@
# Determine if a factory reset has been requested
mkdir -p /var/lock
resetval=$(fw_printenv -n rwreset 2>/dev/null)
-gpiopresent=$(gpiofind factory-reset-toggle)
-if [ $? -eq 0 ]; then
- gpioval=$(gpioget $gpiopresent)
+if gpiopresent=$(gpiofind factory-reset-toggle) ; then
+ gpioval=$(gpioget "$gpiopresent")
else
gpioval=""
fi
# Prevent unnecessary resets on first boot
-if [ -n "$gpioval" -a -z "$resetval" ]; then
- fw_setenv rwreset $gpioval
+if [ -n "$gpioval" ] && [ -z "$resetval" ]; then
+ fw_setenv rwreset "$gpioval"
resetval=$gpioval
fi
-if [ "$resetval" = "true" -o -n "$gpioval" -a "$resetval" != "$gpioval" ]; then
+if [ "$resetval" = "true" ] || [ -n "$gpioval" ] && [ "$resetval" != "$gpioval" ]; then
echo "Factory reset requested."
if ! mkfs.ext4 -F "${rwfsdev}"; then
echo "Reformat for factory reset failed."
/bin/sh
else
# gpioval will be an empty string if factory-reset-toggle was not found
- fw_setenv rwreset $gpioval
+ fw_setenv rwreset "$gpioval"
echo "rwfs has been formatted."
fi
fi
@@ -95,7 +94,7 @@
mount overlay $rodir/etc -t overlay -o lowerdir=$rodir/etc,upperdir=$rodir/var/persist/etc,workdir=$rodir/var/persist/etc-work
for f in $fslist; do
- mount --move $f $rodir/$f
+ mount --move "$f" "$rodir/$f"
done
exec switch_root $rodir /sbin/init
diff --git a/meta-phosphor/scripts/run-repotest b/meta-phosphor/scripts/run-repotest
index 9abc583..bb136fd 100755
--- a/meta-phosphor/scripts/run-repotest
+++ b/meta-phosphor/scripts/run-repotest
@@ -145,7 +145,6 @@
meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-update.sh
-meta-phosphor/recipes-phosphor/initrdscripts/phosphor-mmc-init/mmc-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