mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
408baa9903
commit
02e11ceeaa
@@ -42,19 +42,28 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then
|
[ "$DEVCACHE" != "" ] || exit 0
|
||||||
echo "Populating dev cache"
|
[ "${VERBOSE}" == "no" ] || echo -n "udev-cache: checking for ${DEVCACHE_REGEN}... "
|
||||||
(
|
if ! [ -e "$DEVCACHE_REGEN" ]; then
|
||||||
udevadm control --stop-exec-queue
|
[ "${VERBOSE}" == "no" ] || echo "not found."
|
||||||
sysconf_cmd > "$SYSCONF_TMP"
|
exit 0
|
||||||
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"
|
|
||||||
) &
|
|
||||||
fi
|
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
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user