initscripts: update populate-volatile.sh

If a partition such as /tmp mounted on a volatile directory which create
by script populate-volatile.sh from initscripts, it will show errors.

In /var/log/boot, error message:

Thu Jun 19 05:39:09 2014: bootlogd.
Thu Jun 19 05:39:10 2014: rm: cannot remove '/tmp': Device or resource busy

Check volatile directories and if it is be mounted then don't force make
it as a link.

(From OE-Core rev: cc4b0936c7a6a1563dc88d62d8c9020791eaa446)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kai Kang 2014-06-19 15:31:52 +08:00 committed by Richard Purdie
parent 953b01e1de
commit d0f01d8a21
1 changed files with 6 additions and 4 deletions

View File

@ -72,10 +72,12 @@ link_file() {
if [ -L \"$2\" ]; then
[ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
elif [ -d \"$2\" ]; then
cp -a $2/* $1 2>/dev/null;
cp -a $2/.[!.]* $1 2>/dev/null;
rm -rf \"$2\";
ln -sf \"$1\" \"$2\";
if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
cp -a $2/* $1 2>/dev/null;
cp -a $2/.[!.]* $1 2>/dev/null;
rm -rf \"$2\";
ln -sf \"$1\" \"$2\";
fi
else
ln -sf \"$1\" \"$2\";
fi