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, 33 insertions, 4 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 35316ec2ba..824f8f3a6b 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -112,7 +112,6 @@ check_requirements() {
112 } 112 }
113 113
114 CFGFILE="$1" 114 CFGFILE="$1"
115 [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0
116 115
117 TMP_INTERMED="${TMPROOT}/tmp.$$" 116 TMP_INTERMED="${TMPROOT}/tmp.$$"
118 TMP_DEFINED="${TMPROOT}/tmpdefined.$$" 117 TMP_DEFINED="${TMPROOT}/tmpdefined.$$"
@@ -154,8 +153,11 @@ check_requirements() {
154 153
155apply_cfgfile() { 154apply_cfgfile() {
156 CFGFILE="$1" 155 CFGFILE="$1"
156 SKIP_REQUIREMENTS="$2"
157 157
158 check_requirements "${CFGFILE}" || { 158 [ "${VERBOSE}" != "no" ] && echo "Applying ${CFGFILE}"
159
160 [ "${SKIP_REQUIREMENTS}" == "yes" ] || check_requirements "${CFGFILE}" || {
159 echo "Skipping ${CFGFILE}" 161 echo "Skipping ${CFGFILE}"
160 return 1 162 return 1
161 } 163 }
@@ -231,10 +233,37 @@ then
231 sh ${ROOT_DIR}/etc/volatile.cache 233 sh ${ROOT_DIR}/etc/volatile.cache
232else 234else
233 rm -f ${ROOT_DIR}/etc/volatile.cache ${ROOT_DIR}/etc/volatile.cache.build 235 rm -f ${ROOT_DIR}/etc/volatile.cache ${ROOT_DIR}/etc/volatile.cache.build
234 for file in `ls -1 "${CFGDIR}" | sort`; do 236
235 apply_cfgfile "${CFGDIR}/${file}" 237 # Apply the core file with out checking requirements. ${TMPROOT} is
238 # needed by check_requirements but is setup by this file, so it must be
239 # processed first and without being checked.
240 [ -e "${CFGDIR}/${COREDEF}" ] && apply_cfgfile "${CFGDIR}/${COREDEF}" "yes"
241
242 # Fast path: check_requirements is slow and most of the time doesn't
243 # find any problems. If there are a lot of config files, it is much
244 # faster to to concatenate them all together and process them once to
245 # avoid the overhead of calling check_requirements repeatedly
246 TMP_FILE="${TMPROOT}/tmp_volatile.$$"
247 rm -f "$TMP_FILE"
248
249 CFGFILES="`ls -1 "${CFGDIR}" | grep -v "^${COREDEF}\$" | sort`"
250 for file in ${CFGFILES}; do
251 cat "${CFGDIR}/${file}" >> "$TMP_FILE"
236 done 252 done
237 253
254 if check_requirements "$TMP_FILE"
255 then
256 apply_cfgfile "$TMP_FILE" "yes"
257 else
258 # Slow path: One or more config files failed requirements.
259 # Process each one individually so the offending one can be
260 # skipped
261 for file in ${CFGFILES}; do
262 apply_cfgfile "${CFGDIR}/${file}"
263 done
264 fi
265 rm "$TMP_FILE"
266
238 [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache 267 [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache
239fi 268fi
240 269