[PATCH openbmc 2/9] obmc-initfs: shutdown: use absolute paths

OpenBMC Patches openbmc-patches at stwcx.xyz
Wed Feb 10 05:00:15 AEDT 2016


From: Milton Miller <miltonm at us.ibm.com>

In shutdown, cd to / like init and update, but do not switch
paths to assume this.  Instead switch a few more paths to be
absolute.  This will clarify the expcted execution environment
and the location of files being tested.  It also provides
consistency when calling /update and creating and testing
the /image- symlinks.

Signed-off-by: Milton Miller <miltonm at us.ibm.com>
---
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
index d29db26..c550e06 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
@@ -5,10 +5,11 @@ echo shutdown: "$@"
 export PS1=shutdown-sh#\ 
 # exec bin/sh
 
+cd /
 if [ ! -e /proc/mounts ]
 then
 	mkdir -p /proc
-	mount  proc proc -tproc
+	mount  proc /proc -tproc
 	umount_proc=1
 else
 	umount_proc=
@@ -30,7 +31,7 @@ then
 	ln -sn /run/fw_env /image-u-boot-env
 fi
 
-if test -x /update && ls image-* > /dev/null 2>&1
+if test -x /update && ls /image-* > /dev/null 2>&1
 then
 	exec /update ${1+"$@"}
 fi
-- 
2.6.4




More information about the openbmc mailing list