[V5,08/10] populate-volatile.sh: use 'cp -a' to avoid potential problem

Submitted by Qi.Chen@windriver.com on Aug. 8, 2013, 6:16 a.m.

Details

Message ID d30fe67cd5921ebea9cb7b64d092d02ac1301b17.1375941355.git.Qi.Chen@windriver.com
State New
Headers show

Commit Message

Qi.Chen@windriver.com Aug. 8, 2013, 6:16 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

Previously, dead links in target directory will not be copied.
This is incorrect as dead links are not uncommon in our rootfs.
So we use '-a' option instead.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../initscripts-1.0/populate-volatile.sh           |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index c83d575..9f29ca3 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -76,7 +76,8 @@  link_file() {
 	if [ -L \"$2\" ]; then
 		[ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
 	elif [ -d \"$2\" ]; then
-		for f in $2/* $2/.[^.]*; do [ -e \$f ] && cp -rf \$f $1; done;
+		cp -a $2/* $1;
+		cp -a $2/.[!.]* $1;
 		rm -rf \"$2\";
 		ln -sf \"$1\" \"$2\";
 	else