udev-cache: omit sockets and filesystems mounted under /dev
authorRichard Tollerton <rich.tollerton@ni.com>
Fri, 22 Aug 2014 21:30:52 +0000 (16:30 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 23 Aug 2014 22:01:59 +0000 (23:01 +0100)
commit890bb87af6113654509c45217842b189daf785e2
tree75a1709e3dcf21586a3374d1d1d07063355b6857
parent30183634a50907cacea512caf82e32278512153c
udev-cache: omit sockets and filesystems mounted under /dev

Archiving sockets causes tar to report an error and return a nonzero
exit status. Archiving a mounted filesystem is harmless, but may greatly
bloat the size of the cache tarball, and wastes time on boot.

To fix these issues, use `find` to only include the files we want, which
are the file types that udev will create (block/char devices and
symlinks) that are on the same filesystem as /dev.

While we're at it, remove a subshell by archiving /dev as an absolute
path. However, `tar` will complain about stripping the leading slash on
stderr. To inhibit this, `cut` out the leading slash.

An alternative solution is to use `tar --exclude`, but that is modestly
more brittle, since we'd need to explicitly list every socket and
filesystem to exclude. Note that `tar --one-file-system` is
GNU-specific, and tar implementations generally have nothing equivalent
to `find -type`.

If using busybox `find`, this change requires CONFIG_FEATURE_FIND_TYPE=y
and CONFIG_FEATURE_FIND_XDEV=y. If using busybox `tar`, this change
requires CONFIG_FEATURE_TAR_FROM=y.

(From OE-Core rev: e89df123e2ec516ae61763eab3c9e78e067e28d5)

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/udev/udev/udev-cache