diff options
author | Richard Tollerton <rich.tollerton@ni.com> | 2014-08-22 16:30:54 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-23 23:01:59 +0100 |
commit | fd0aa6af628247d41fc61ba84be748f2f4fc2a72 (patch) | |
tree | 5798c32406ed771ed9d6d85fe64c476032b9a0b5 | |
parent | 7c56a5e728f4c5adb3c9df7cf3cb2da782e3c94c (diff) | |
download | poky-fd0aa6af628247d41fc61ba84be748f2f4fc2a72.tar.gz |
udev-cache: parametrize sysconf file paths
The udev-cache facility uses files that represent system states, to
ensure that the cache tarball is valid to apply. These paths were
hardcoded in several places; collect them into SYSCONF_CACHED and
SYSCONF_TMP.
(From OE-Core rev: f4fcb237da0d1013005e9a0bb2381cfeb4c5316c)
Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/udev/udev/init | 10 | ||||
-rw-r--r-- | meta/recipes-core/udev/udev/udev-cache | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init index ce0a68c0fc..96bd774d24 100644 --- a/meta/recipes-core/udev/udev/init +++ b/meta/recipes-core/udev/udev/init | |||
@@ -14,6 +14,8 @@ export TZ=/etc/localtime | |||
14 | [ -d /sys/class ] || exit 1 | 14 | [ -d /sys/class ] || exit 1 |
15 | [ -r /proc/mounts ] || exit 1 | 15 | [ -r /proc/mounts ] || exit 1 |
16 | [ -x @UDEVD@ ] || exit 1 | 16 | [ -x @UDEVD@ ] || exit 1 |
17 | SYSCONF_CACHED="/etc/udev/cache.data" | ||
18 | SYSCONF_TMP="/dev/shm/udev.cache" | ||
17 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache | 19 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache |
18 | [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf | 20 | [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf |
19 | [ -f /etc/default/rcS ] && . /etc/default/rcS | 21 | [ -f /etc/default/rcS ] && . /etc/default/rcS |
@@ -66,13 +68,13 @@ case "$1" in | |||
66 | if [ -e $DEVCACHE ]; then | 68 | if [ -e $DEVCACHE ]; then |
67 | readfiles $CMP_FILE_LIST | 69 | readfiles $CMP_FILE_LIST |
68 | NEWDATA="$READDATA" | 70 | NEWDATA="$READDATA" |
69 | readfiles /etc/udev/cache.data | 71 | readfiles "$SYSCONF_CACHED" |
70 | OLDDATA="$READDATA" | 72 | OLDDATA="$READDATA" |
71 | if [ "$OLDDATA" = "$NEWDATA" ]; then | 73 | if [ "$OLDDATA" = "$NEWDATA" ]; then |
72 | tar xmf $DEVCACHE -C / -m | 74 | tar xmf $DEVCACHE -C / -m |
73 | not_first_boot=1 | 75 | not_first_boot=1 |
74 | [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE" | 76 | [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE" |
75 | [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache | 77 | [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP" |
76 | else | 78 | else |
77 | # Output detailed reason why the cached /dev is not used | 79 | # Output detailed reason why the cached /dev is not used |
78 | if [ "$VERBOSE" != "no" ]; then | 80 | if [ "$VERBOSE" != "no" ]; then |
@@ -81,14 +83,14 @@ case "$1" in | |||
81 | echo "udev: olddata: $OLDDATA" | 83 | echo "udev: olddata: $OLDDATA" |
82 | echo "udev: newdata: $NEWDATA" | 84 | echo "udev: newdata: $NEWDATA" |
83 | fi | 85 | fi |
84 | echo "$NEWDATA" > /dev/shm/udev.cache | 86 | echo "$NEWDATA" > "$SYSCONF_TMP" |
85 | fi | 87 | fi |
86 | else | 88 | else |
87 | if [ "$ROOTFS_READ_ONLY" != "yes" ]; then | 89 | if [ "$ROOTFS_READ_ONLY" != "yes" ]; then |
88 | # If rootfs is not read-only, it's possible that a new udev cache would be generated; | 90 | # If rootfs is not read-only, it's possible that a new udev cache would be generated; |
89 | # otherwise, we do not bother to read files. | 91 | # otherwise, we do not bother to read files. |
90 | readfiles $CMP_FILE_LIST | 92 | readfiles $CMP_FILE_LIST |
91 | echo "$READDATA" > /dev/shm/udev.cache | 93 | echo "$READDATA" > "$SYSCONF_TMP" |
92 | fi | 94 | fi |
93 | fi | 95 | fi |
94 | fi | 96 | fi |
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache index aaf1ddd1ac..497d257397 100644 --- a/meta/recipes-core/udev/udev/udev-cache +++ b/meta/recipes-core/udev/udev/udev-cache | |||
@@ -17,6 +17,8 @@ export TZ=/etc/localtime | |||
17 | 17 | ||
18 | [ -f /etc/default/rcS ] && . /etc/default/rcS | 18 | [ -f /etc/default/rcS ] && . /etc/default/rcS |
19 | DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar" | 19 | DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar" |
20 | SYSCONF_CACHED="/etc/udev/cache.data" | ||
21 | SYSCONF_TMP="/dev/shm/udev.cache" | ||
20 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache | 22 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache |
21 | 23 | ||
22 | if [ "$ROOTFS_READ_ONLY" = "yes" ]; then | 24 | if [ "$ROOTFS_READ_ONLY" = "yes" ]; then |
@@ -24,13 +26,13 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then | |||
24 | exit 0 | 26 | exit 0 |
25 | fi | 27 | fi |
26 | 28 | ||
27 | if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then | 29 | if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then |
28 | echo "Populating dev cache" | 30 | echo "Populating dev cache" |
29 | find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \ | 31 | find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \ |
30 | | xargs tar cf "${DEVCACHE_TMP}" -T- | 32 | | xargs tar cf "${DEVCACHE_TMP}" -T- |
31 | gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" | 33 | gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" |
32 | rm -f "${DEVCACHE_TMP}" | 34 | rm -f "${DEVCACHE_TMP}" |
33 | mv /dev/shm/udev.cache /etc/udev/cache.data | 35 | mv "$SYSCONF_TMP" "$SYSCONF_CACHED" |
34 | fi | 36 | fi |
35 | 37 | ||
36 | exit 0 | 38 | exit 0 |