populate-volatile.sh: add ROOT_DIR variable to support running at rootfs time
authorChen Qi <Qi.Chen@windriver.com>
Mon, 18 Feb 2013 09:14:49 +0000 (17:14 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Mar 2013 11:14:33 +0000 (11:14 +0000)
commit87a7df8091951f31581060f9b4f6ef57c6b59b96
treec514d39f6707acb713e30d6498a7dcc00a2dd96f
parente9840705439663a7dd0c878847d325598e425b4a
populate-volatile.sh: add ROOT_DIR variable to support running at rootfs time

For populate-volatile.sh script to run correctly both at rootfs time and
at system boot time, it needs to be aware of which situation it is now in.

We use the ROOT_DIR variable to indicate whether it is run at rootfs time or
not. ROOT_DIR being "/" indicates that this script is run at system boot time,
otherwise, it is run at rootfs time.

Also, we ignore failures when running this script at rootfs time.
For example, if ${ROOT_DIR}/var/dir1 is symlink to /var/volatile/dir1, it's
possible that the link is a dead link. So if we're going to create some file
under ${ROOT_DIR}/var/dir1, it will fail. But the failure does no harm,
because this script will always run at system boot time to set up the correct
files and directories.

[YOCTO #3406]

(From OE-Core rev: 45396e3edcce4a33fcbef6456f31811f30c26c63)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh