obmc-initfs: init: check init is an executable file
In init, check the new init is an executable file with non-zero
size in addition to the shell being executable with its shared
libraries.
Signed-off-by: Milton Miller <miltonm@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index 0dc4c35..eed8cf5 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -69,9 +69,10 @@
mount -t overlay -o lowerdir=$rodir,upperdir=$upper,workdir=$work cow /root
-if ! chroot /root /bin/sh -c exit
+if ! chroot /root /bin/sh -c "test -x /sbin/init -a -s /sbin/init"
then
- echo 'chroot test failed; invoking emergency shell.'
+ echo "Unable to confirm /sbin/init is an executable non-empty file."
+ echo "Change Root test failed! Invoking emergency shell."
PS1=rescue#\ sulogin
fi