summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev/udev/udev-cache
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/udev/udev/udev-cache')
-rw-r--r--meta/recipes-core/udev/udev/udev-cache38
1 files changed, 38 insertions, 0 deletions
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
new file mode 100644
index 0000000000..497d257397
--- /dev/null
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -0,0 +1,38 @@
1#!/bin/sh -e
2
3### BEGIN INIT INFO
4# Provides: udev-cache
5# Required-Start: mountall
6# Required-Stop:
7# Default-Start: S
8# Default-Stop:
9# Short-Description: cache /dev to speedup the udev next boot
10### END INIT INFO
11
12export TZ=/etc/localtime
13
14[ -r /proc/mounts ] || exit 1
15[ -x @UDEVD@ ] || exit 1
16[ -d /sys/class ] || exit 1
17
18[ -f /etc/default/rcS ] && . /etc/default/rcS
19DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
20SYSCONF_CACHED="/etc/udev/cache.data"
21SYSCONF_TMP="/dev/shm/udev.cache"
22[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
23
24if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
25 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
26 exit 0
27fi
28
29if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
30 echo "Populating dev cache"
31 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
32 | xargs tar cf "${DEVCACHE_TMP}" -T-
33 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
34 rm -f "${DEVCACHE_TMP}"
35 mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
36fi
37
38exit 0