meta-hpe: remove bash dependency

Images built for HPE machines become too large when bash is added as a dependency.

Change-Id: Ib6e49647c22f1d0345ef44ffc9140ac73ed999b1
Signed-off-by: Charles Kearney <charles.kearney@hpe.com>
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 c0f5d64..58cc921 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,8 +14,6 @@
 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 c43ed34..06bfecd 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,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 findmtd() {
   m=$(grep -xl "$1" /sys/class/mtd/*/name)
@@ -7,10 +7,9 @@
   echo "$m"
 }
 
-rom_lists=(host-prime host-second vrom-prime vrom-second)
-rom_mtd_list=()
+set -- host-prime host-second vrom-prime vrom-second
 
-for f in "${rom_lists[@]}"
+for f in "$@"
 do
   image=$(findmtd "${f}")
   if test -z "$image"
@@ -18,14 +17,13 @@
     echo "Unable to find mtd partition for ${f}"
     exit 1
   fi
-  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/$(findmtd host-prime)" of="/dev/$(findmtd vrom-prime)"
 # host-second to vrom-second
-dd if="/dev/${rom_mtd_list[1]}" of="/dev/${rom_mtd_list[3]}"
+dd if="/dev/$(findmtd host-second)" of="/dev/$(findmtd vrom-second)"
 
 echo 0x1800008a > /sys/class/soc/srom/vromoff
 
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 53905fc..b61f9c2 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/bash
+#!/bin/sh
 
 fslist="proc sys dev run"
 rodir=run/initramfs/ro
@@ -7,7 +7,10 @@
 work=$rwdir/work
 
 cd /
-mkdir -p "$fslist"
+for f in $fslist
+do
+	mkdir -p "$f"
+done
 mount dev dev -tdevtmpfs
 mount sys sys -tsysfs
 mount proc proc -tproc
@@ -125,15 +128,23 @@
 	fi
 }
 
+getch() {
+        old=$(stty -g)
+        stty raw -echo min 0 time 50
+        printf '%s' "$(dd bs=1 count=1 2>/dev/null)"
+        stty "$old"
+}
+
 debug_takeover() {
 	echo "$@"
-	read -t 5 -n 1 -s -r -p  "Press any key to log in and try to manually fix, force recovery in 5 seconds"
-	if test $? -gt 0
+	echo "Press (Y/y) to log in and try to manually fix, force recovery in 5 seconds"
+	answer=$(getch)
+	if [ "$answer" != "y" ] && [ "$answer" != "Y" ] ; 
 	then
 		mkdir -p /var/lock
 		envdev=$(findmtd u-boot-env)
-		echo -e "/dev/${envdev}\t0x00000\t0x10000" > /etc/fw_env.config
-		echo -e "/dev/${envdev}\t0x10000\t0x10000" >> /etc/fw_env.config
+		echo "/dev/${envdev}     0x00000     0x10000" > /etc/fw_env.config
+		echo "/dev/${envdev}     0x10000     0x10000" >> /etc/fw_env.config
 		fw_setenv force_recovery 1
 		fw_setenv last_booterrmsg "$@"
 		devmem 0xc0000000 32 0x01
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 b4092a1..17110b3 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
@@ -10,4 +10,3 @@
 FILES:${PN} += " /init /shutdown /update /whitelist /dev "
 FILES:${PN} += " /init-options /init-download-url "
 
-RDEPENDS:${PN}:append = " bash"
diff --git a/meta-hpe/meta-common/recipes-phosphor/packagegroups/packagegroup-hpe-apps.bb b/meta-hpe/meta-common/recipes-phosphor/packagegroups/packagegroup-hpe-apps.bb
index 5f711a2..909f3b8 100644
--- a/meta-hpe/meta-common/recipes-phosphor/packagegroups/packagegroup-hpe-apps.bb
+++ b/meta-hpe/meta-common/recipes-phosphor/packagegroups/packagegroup-hpe-apps.bb
@@ -45,4 +45,5 @@
         phosphor-ipmi-ipmb \
         dbus-sensors \
         host-ehci-owner-reset \
+        host-boot-enable \
         "
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 e8b0ea6..4fc41d0 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,2 +1 @@
 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 bff898d..0752205 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,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 findmtd() {
   m=$(grep -xl "$1" /sys/class/mtd/*/name)
@@ -7,10 +7,9 @@
   echo "$m"
 }
 
-rom_lists=(host-prime host-second vrom-prime vrom-second)
-rom_mtd_list=()
+set -- host-prime host-second vrom-prime vrom-second
 
-for f in "${rom_lists[@]}"
+for f in "$@"
 do
   image=$(findmtd "${f}")
   if test -z "$image"
@@ -18,14 +17,13 @@
     echo "Unable to find mtd partition for ${f}"
     exit 1
   fi
-  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/$(findmtd host-prime)" of="/dev/$(findmtd vrom-prime)"
 # host-second to vrom-second
-dd if="/dev/${rom_mtd_list[1]}" of="/dev/${rom_mtd_list[3]}"
+dd if="/dev/$(findmtd host-second)" of="/dev/$(findmtd vrom-second)"
 
 echo 0x1800008a > /sys/class/soc/srom/vromoff
 
@@ -38,3 +36,4 @@
         sleep 1
 done
 
+ 
\ No newline at end of file