udev-cache: Update cache asynchronously

Don't hold up the boot while the cache is being updated.

(From OE-Core rev: eb52b257511b7624c8e212f5e9df711935d619ee)

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Tollerton 2014-01-13 15:51:33 -06:00 committed by Richard Purdie
parent 88c184a9bf
commit 408baa9903
1 changed files with 11 additions and 9 deletions

View File

@ -44,15 +44,17 @@ 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"
(
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"
) &
fi
exit 0