aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-01-21 13:46:46 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-19 18:08:02 +0000
commit02e11ceeaa1e56eb01bf0e07cb3514b03862acfa (patch)
treeb148c9f765bd1d4fcec2134ecb14688fffc9a6b4 /meta/recipes-core/udev
parent408baa9903bbfd16485fcba74430558e518d29ed (diff)
downloadopenembedded-core-contrib-02e11ceeaa1e56eb01bf0e07cb3514b03862acfa.tar.gz
udev-cache: refactor conditionals and error handling
Most of /etc/init.d/udev-cache is in a conditional block which can be replaced by a `[ ... ] || exit 0` to reduce nesting. This also provides an opportunity to add some additional messages when VERBOSE is set. Capture and report errors encountered in the cache generation process, using set -e and trap EXIT. These errors were previously being ignored. (From OE-Core rev: a1357f3c78e46cd4297fefab56acf87342967132) Signed-off-by: Richard Tollerton <rich.tollerton@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/udev/udev-cache35
1 files changed, 22 insertions, 13 deletions
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 3c18061991..895b1971c4 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -42,19 +42,28 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
exit 0
fi
-if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then
- echo "Populating dev cache"
- (
- udevadm control --stop-exec-queue
- sysconf_cmd > "$SYSCONF_TMP"
- find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
- | xargs tar cf "${DEVCACHE_TMP}" -T-
- gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
- rm -f "${DEVCACHE_TMP}"
- mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
- udevadm control --start-exec-queue
- rm -f "$DEVCACHE_REGEN"
- ) &
+[ "$DEVCACHE" != "" ] || exit 0
+[ "${VERBOSE}" == "no" ] || echo -n "udev-cache: checking for ${DEVCACHE_REGEN}... "
+if ! [ -e "$DEVCACHE_REGEN" ]; then
+ [ "${VERBOSE}" == "no" ] || echo "not found."
+ exit 0
fi
+[ "${VERBOSE}" == "no" ] || echo "found."
+echo "Populating dev cache"
+
+(
+ set -e
+ trap 'echo "udev-cache: update failed!"' EXIT
+ udevadm control --stop-exec-queue
+ sysconf_cmd > "$SYSCONF_TMP"
+ find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
+ | xargs tar cf "${DEVCACHE_TMP}" -T-
+ gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
+ rm -f "${DEVCACHE_TMP}"
+ mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
+ udevadm control --start-exec-queue
+ rm -f "$DEVCACHE_REGEN"
+ trap - EXIT
+) &
exit 0