meta-hpe: fix shellcheck issues

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I30885f8c2577c3c2aa333a61210e6738fbf016c7
diff --git a/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable.bb b/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable.bb
index 58cc921..c0f5d64 100644
--- a/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable.bb
+++ b/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable.bb
@@ -14,6 +14,8 @@
 SRC_URI += "file://host-boot-enable.service"
 SRC_URI += "file://host-boot-enable.sh"
 
+RDEPENDS:${PN}:append = " bash"
+
 do_install() {
 	install -d ${D}${bindir}
 	install -m 0755 ${WORKDIR}/host-boot-enable.sh ${D}${bindir}
diff --git a/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh b/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
index 1798607..c43ed34 100644
--- a/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
+++ b/meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/bash
 
 findmtd() {
   m=$(grep -xl "$1" /sys/class/mtd/*/name)
   m=${m%/name}
   m=${m##*/}
-  echo $m
+  echo "$m"
 }
 
 rom_lists=(host-prime host-second vrom-prime vrom-second)
@@ -12,27 +12,27 @@
 
 for f in "${rom_lists[@]}"
 do
-  image=$(findmtd ${f})
+  image=$(findmtd "${f}")
   if test -z "$image"
   then
     echo "Unable to find mtd partition for ${f}"
     exit 1
   fi
-  rom_mtd_list+=($image)
+  rom_mtd_list+=("$image")
 done
 
 #enable vrom
 # host-prime to vrom-prime
-dd if=/dev/${rom_mtd_list[0]} of=/dev/${rom_mtd_list[2]}
+dd if="/dev/${rom_mtd_list[0]}" of="/dev/${rom_mtd_list[2]}"
 # host-second to vrom-second
-dd if=/dev/${rom_mtd_list[1]} of=/dev/${rom_mtd_list[3]}
+dd if="/dev/${rom_mtd_list[1]}" of="/dev/${rom_mtd_list[3]}"
 
 echo 0x1800008a > /sys/class/soc/srom/vromoff
 
 val=$(( ("$(devmem 0xd1000006 8)" && 0xff) | 0x04 ))
 devmem 0xd1000006 8 $val
 devmem 0xd1000018 8 0xff
-while [ true ]
+while true
 do
         devmem 0xd100000f 8 0x14
         sleep 1
diff --git a/meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh b/meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh
index e2a9ebc..53905fc 100644
--- a/meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh
+++ b/meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 fslist="proc sys dev run"
 rodir=run/initramfs/ro
@@ -7,7 +7,7 @@
 work=$rwdir/work
 
 cd /
-mkdir -p $fslist
+mkdir -p "$fslist"
 mount dev dev -tdevtmpfs
 mount sys sys -tsysfs
 mount proc proc -tproc
@@ -27,7 +27,7 @@
 	m=$(grep -xl "$1" /sys/class/mtd/*/name)
 	m=${m%/name}
 	m=${m##*/}
-	echo $m
+	echo "$m"
 }
 
 blkid_fs_type() {
@@ -36,12 +36,12 @@
 	#    # blkid /dev/mtdblock5
 	#    /dev/mtdblock5: TYPE="squashfs"
 	# Process output to extract TYPE value "squashfs".
-	blkid $1 | sed -e 's/^.*TYPE="//' -e 's/".*$//'
+	blkid "$1" | sed -e 's/^.*TYPE="//' -e 's/".*$//'
 }
 
 probe_fs_type() {
-	fst=$(blkid_fs_type $1)
-	echo ${fst:=jffs2}
+	fst=$(blkid_fs_type "$1")
+	echo "${fst:=jffs2}"
 }
 
 # This fw_get_env_var is a possibly broken version of fw_printenv that
@@ -65,10 +65,9 @@
 	# * print the value of the variable name passed as argument
 
 	envdev=$(findmtd u-boot-env)
-	if test -n $envdev
+	if test -n "$envdev"
 	then
-		cat /dev/$envdev |
-		tr '\n\000' '\r\n' |
+		tr '\n\000' '\r\n' < "/dev/$envdev" |
 		tail -c +5 | tail -c +${copies-1} |
 		sed -ne '/^$/,$d' -e "s/^$1=//p"
 	fi
@@ -98,10 +97,10 @@
 
 	rest="${1#tftp://}"
 	path=${rest#*/}
-	host=${rest%$path}
+	host=${rest%"$path"}
 	host="${host%/}"
-	port="${host#${host%:*}}"
-	host="${host%$port}"
+	port="${host#"${host%:*}"}"
+	host="${host%"$port"}"
 	port="${port#:}"
 
 	setup_resolv
@@ -159,7 +158,7 @@
 
 Warning: No job control!  Shell exit will panic the system!
 HERE
-		export PS1=init#\ 
+		export PS1=init#\
 		exec /bin/sh
 	fi
 }
@@ -169,8 +168,8 @@
   devmem 0x800000b8 16 0xFF
   dip=$(devmem 0x800000b8 16)
 
-  value1=$((( $dip & 0xFF00 ) >> 8 ))
-  value2=$((( $dip & 0x0040 ) >> 6 ))
+  value1=$((( dip & 0xFF00 ) >> 8 ))
+  value2=$((( dip & 0x0040 ) >> 6 ))
 
   if [ $value1 -eq 0 ] && [ $value2 -eq 1 ]
   then
@@ -195,7 +194,7 @@
 consider_download_ftp=y
 
 rofst=squashfs
-rwfst=$(probe_fs_type $rwdev)
+rwfst=$(probe_fs_type "$rwdev")
 roopts=ro
 rwopts=rw
 
@@ -230,14 +229,14 @@
 	get_fw_env_var openbmconce >> $optfile
 fi
 
-echo rofs = $rofs $rofst   rwfs = $rwfs $rwfst
+echo "rofs = $rofs $rofst   rwfs = $rwfs $rwfst"
 
 if grep -w debug-init-sh $optfile
 then
 	debug_takeover "Debug initial shell requested by command line."
 fi
 
-if test "x$consider_download_files" = xy &&
+if test "$consider_download_files" = "y" &&
 	grep -w openbmc-init-download-files $optfile
 then
 	if test -f ${urlfile##*/}
@@ -250,7 +249,7 @@
 	fi
 	url="$(cat $urlfile)"
 	rest="${url#*://}"
-	proto="${url%$rest}"
+	proto="${url%"$rest"}"
 
 	if test -z "$url"
 	then
@@ -260,7 +259,7 @@
 		echo "Download failed."
 	elif test "$proto" = tftp://
 	then
-		if test "x$consider_download_tftp" = xy
+		if test "$consider_download_tftp" = "y"
 		then
 			try_tftp "$url"
 		else
@@ -268,7 +267,7 @@
 		fi
 	elif test "$proto" = http://
 	then
-		if test "x$consider_download_http" = xy
+		if test "$consider_download_http" = "y"
 		then
 			try_wget "$url"
 		else
@@ -276,7 +275,7 @@
 		fi
 	elif test "$proto" = ftp://
 	then
-		if test "x$consider_download_ftp" = xy
+		if test "$consider_download_ftp" = "y"
 		then
 			try_wget "$url"
 		else
@@ -289,15 +288,15 @@
 
 # If there are images in root move them to /run/initramfs/ or /run/ now.
 imagebasename=${image##*/}
-if test -n "${imagebasename}" && ls /${imagebasename}* > /dev/null 2>&1
+if test -n "${imagebasename}" && ls /"${imagebasename}"* > /dev/null 2>&1
 then
-	if test "x$flash_images_before_init" = xy
+	if test "$flash_images_before_init" = "y"
 	then
 		echo "Flash images found, will update before starting init."
-		mv /${imagebasename}* ${image%$imagebasename}
+		mv /"${imagebasename}"* ${image%"$imagebasename"}
 	else
 		echo "Flash images found, will use but deferring flash update."
-		mv /${imagebasename}* /run/
+		mv /"${imagebasename}"* /run/
 	fi
 fi
 
@@ -316,7 +315,7 @@
 	do_save=--save-files
 fi
 
-if test "x$force_rwfst_jffs2" = xy -a $rwfst != jffs2 -a ! -f $trigger
+if test "$force_rwfst_jffs2" = "y" -a "$rwfst" != jffs2 -a ! -f $trigger
 then
 	echo "Converting read-write overlay filesystem to jffs2 forced."
 	touch $trigger
@@ -337,7 +336,7 @@
 		fi
 		$update --no-restore-files $do_save
 		echo "Clearing read-write overlay filesystem."
-		flash_eraseall /dev/$rwfs
+		flash_eraseall "/dev/$rwfs"
 		echo "Restoring saved files to read-write overlay filesystem."
 		touch $trigger
 		$update --no-save-files --clean-saved-files
@@ -345,7 +344,7 @@
 		$update --clean-saved-files $do_save
 	fi
 
-	rwfst=$(probe_fs_type $rwdev)
+	rwfst=$(probe_fs_type "$rwdev")
 	fsck=$fsckbase$rwfst
 fi
 
@@ -370,7 +369,7 @@
 fi
 
 if grep -w copy-base-filesystem-to-ram $optfile &&
-	test ! -e /run/image-rofs && ! cp $rodev /run/image-rofs
+	test ! -e /run/image-rofs && ! cp "$rodev" /run/image-rofs
 then
 	# Remove any partial copy to avoid attempted usage later
 	if test -e  /run/image-rofs
@@ -387,19 +386,19 @@
 	roopts=$roopts,loop
 fi
 
-mount $rodev $rodir -t $rofst -o $roopts
+mount "$rodev" $rodir -t $rofst -o $roopts
 
-if test -x $rodir$fsck
+if test -x "$rodir$fsck"
 then
 	for fs in $fslist
 	do
-		mount --bind $fs $rodir/$fs
+		mount --bind "$fs" "$rodir/$fs"
 	done
-	chroot $rodir $fsck $fsckopts $rwdev
+	chroot $rodir "$fsck" $fsckopts "$rwdev"
 	rc=$?
 	for fs in $fslist
 	do
-		umount $rodir/$fs
+		umount "$rodir/$fs"
 	done
 	if test $rc -gt 1
 	then
@@ -414,7 +413,7 @@
 then
 	echo "Running with read-write overlay in RAM for this boot."
 	echo "No state will be preserved unless flash update performed."
-elif ! mount $rwdev $rwdir -t $rwfst -o $rwopts
+elif ! mount "$rwdev" $rwdir -t "$rwfst" -o $rwopts
 then
 	msg="$(cat)" << HERE
 
@@ -444,7 +443,7 @@
 
 for f in $fslist
 do
-	mount --move $f root/$f
+	mount --move "$f" "root/$f"
 done
 
 # switch_root /root $init
diff --git a/meta-hpe/meta-common/recipes-phosphor/initrdscripts/obmc-phosphor-initfs.bbappend b/meta-hpe/meta-common/recipes-phosphor/initrdscripts/obmc-phosphor-initfs.bbappend
index ab76653..b4092a1 100644
--- a/meta-hpe/meta-common/recipes-phosphor/initrdscripts/obmc-phosphor-initfs.bbappend
+++ b/meta-hpe/meta-common/recipes-phosphor/initrdscripts/obmc-phosphor-initfs.bbappend
@@ -9,3 +9,5 @@
 
 FILES:${PN} += " /init /shutdown /update /whitelist /dev "
 FILES:${PN} += " /init-options /init-download-url "
+
+RDEPENDS:${PN}:append = " bash"
diff --git a/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable.bbappend b/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable.bbappend
index 4fc41d0..e8b0ea6 100644
--- a/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable.bbappend
+++ b/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable.bbappend
@@ -1 +1,2 @@
 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+RDEPENDS:${PN}:append = " bash"
diff --git a/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh b/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
index 08b882d..bff898d 100644
--- a/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
+++ b/meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/bash
 
 findmtd() {
   m=$(grep -xl "$1" /sys/class/mtd/*/name)
   m=${m%/name}
   m=${m##*/}
-  echo $m
+  echo "$m"
 }
 
 rom_lists=(host-prime host-second vrom-prime vrom-second)
@@ -12,24 +12,24 @@
 
 for f in "${rom_lists[@]}"
 do
-  image=$(findmtd ${f})
+  image=$(findmtd "${f}")
   if test -z "$image"
   then
     echo "Unable to find mtd partition for ${f}"
     exit 1
   fi
-  rom_mtd_list+=($image)
+  rom_mtd_list+=("$image")
 done
 
 #enable vrom
 # host-prime to vrom-prime
-dd if=/dev/${rom_mtd_list[0]} of=/dev/${rom_mtd_list[2]}
+dd if="/dev/${rom_mtd_list[0]}" of="/dev/${rom_mtd_list[2]}"
 # host-second to vrom-second
-dd if=/dev/${rom_mtd_list[1]} of=/dev/${rom_mtd_list[3]}
+dd if="/dev/${rom_mtd_list[1]}" of="/dev/${rom_mtd_list[3]}"
 
 echo 0x1800008a > /sys/class/soc/srom/vromoff
 
-while [ true ]
+while true
 do
         devmem 0x8000005C 8 0
         devmem 0xd1000306 8 5
diff --git a/meta-phosphor/scripts/run-repotest b/meta-phosphor/scripts/run-repotest
index 20b45f9..2d8a04c 100755
--- a/meta-phosphor/scripts/run-repotest
+++ b/meta-phosphor/scripts/run-repotest
@@ -125,9 +125,6 @@
 meta-google/recipes-google/test/test-sh/test.sh
 meta-google/recipes-phosphor/flash/google-key/verify-bmc-image.sh
 meta-google/recipes-phosphor/flash/inplace-gbmc-update/inplace-gbmc-verify.sh
-meta-hpe/meta-common/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
-meta-hpe/meta-common/recipes-phosphor/initrdscripts/files/gxp-obmc-init.sh
-meta-hpe/meta-dl360poc/recipes-hpe/host/host-boot-enable/host-boot-enable.sh
 meta-ibm/meta-romulus/recipes-phosphor/chassis/vrm-control/vrm-control.sh
 meta-ibm/recipes-phosphor/chassis/vrm-control/vrm-control.sh
 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh