summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh')
-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