summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2013-02-20 11:28:37 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-07 11:14:33 +0000
commit297906d39cfcaa56009214e8759b9853f82f02d7 (patch)
treed4a8fe84e32ed576dd05a4dc3794b0967557796e /meta/recipes-core
parentbf7a5b449c167a6bcd824b82517509ba6914ec0f (diff)
downloadpoky-297906d39cfcaa56009214e8759b9853f82f02d7.tar.gz
populate-volatile.sh: improve the handling of link config items
Previously, if there's a link config item in the config file like l root root 1777 /tmp /var/tmp and /tmp has existed, the symlink will not be created correctly. Another example is the /run directory. If /run directory has been created by some recipe or script before populate-volatile.sh runs, the symlink of /run to /var/run will not be created correctly. This patch ensures that the system creates symlinks exactly as the config file tells it. [YOCTO #3404] [YOCTO #3406] (From OE-Core rev: a54287d8e3d75a727c8ed5654a822bda256b0849) 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>
Diffstat (limited to 'meta/recipes-core')
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh37
1 files changed, 21 insertions, 16 deletions
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 c4bf70e5de..fec3b0c75c 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -68,20 +68,27 @@ mk_dir() {
68} 68}
69 69
70link_file() { 70link_file() {
71 EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1" 71 EXEC="
72 if [ -L \"$2\" ]; then
73 [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
74 elif [ -d \"$2\" ]; then
75 for f in $2/* $2/.[^.]*; do [ -e \$f ] && cp -rf \$f $1; done;
76 rm -rf \"$2\";
77 ln -sf \"$1\" \"$2\";
78 else
79 ln -sf \"$1\" \"$2\";
80 fi
81 "
72 82
73 test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build 83 test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
74 [ -e "$2" ] && { 84
75 echo "Cannot create link over existing -${TNAME}-." >&2 85 if [ "$ROOT_DIR" = "/" ]; then
76 } || { 86 eval $EXEC &
77 if [ "$ROOT_DIR" = "/" ]; then 87 else
78 eval $EXEC & 88 # For the same reason with create_file(), failures should
79 else 89 # not be logged.
80 # For the same reason with create_file(), failures should 90 eval $EXEC > /dev/null 2>&1 &
81 # not be logged. 91 fi
82 eval $EXEC > /dev/null 2>&1 &
83 fi
84 }
85} 92}
86 93
87check_requirements() { 94check_requirements() {
@@ -148,10 +155,8 @@ apply_cfgfile() {
148 155
149 [ "${TTYPE}" = "l" ] && { 156 [ "${TTYPE}" = "l" ] && {
150 TSOURCE="$TLTARGET" 157 TSOURCE="$TLTARGET"
151 [ -L "${TNAME}" ] || { 158 [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
152 [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." 159 link_file "${TSOURCE}" "${TNAME}" &
153 link_file "${TSOURCE}" "${TNAME}" &
154 }
155 continue 160 continue
156 } 161 }
157 162