summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Tollerton <rich.tollerton@ni.com>2014-08-22 16:30:54 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-23 23:01:35 +0100
commitf4fcb237da0d1013005e9a0bb2381cfeb4c5316c (patch)
treeb075e48759b51288c2f64025c885e9607c9e817e
parent09089962be353280201ba3899fd5ef9cc3c0ba32 (diff)
downloadopenembedded-core-f4fcb237da0d1013005e9a0bb2381cfeb4c5316c.tar.gz
openembedded-core-f4fcb237da0d1013005e9a0bb2381cfeb4c5316c.tar.bz2
openembedded-core-f4fcb237da0d1013005e9a0bb2381cfeb4c5316c.zip
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. 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/init10
-rw-r--r--meta/recipes-core/udev/udev/udev-cache6
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
[ -d /sys/class ] || exit 1
[ -r /proc/mounts ] || exit 1
[ -x @UDEVD@ ] || exit 1
+SYSCONF_CACHED="/etc/udev/cache.data"
+SYSCONF_TMP="/dev/shm/udev.cache"
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
[ -f /etc/default/rcS ] && . /etc/default/rcS
@@ -66,13 +68,13 @@ case "$1" in
if [ -e $DEVCACHE ]; then
readfiles $CMP_FILE_LIST
NEWDATA="$READDATA"
- readfiles /etc/udev/cache.data
+ readfiles "$SYSCONF_CACHED"
OLDDATA="$READDATA"
if [ "$OLDDATA" = "$NEWDATA" ]; then
tar xmf $DEVCACHE -C / -m
not_first_boot=1
[ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
- [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
+ [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP"
else
# Output detailed reason why the cached /dev is not used
if [ "$VERBOSE" != "no" ]; then
@@ -81,14 +83,14 @@ case "$1" in
echo "udev: olddata: $OLDDATA"
echo "udev: newdata: $NEWDATA"
fi
- echo "$NEWDATA" > /dev/shm/udev.cache
+ echo "$NEWDATA" > "$SYSCONF_TMP"
fi
else
if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
# If rootfs is not read-only, it's possible that a new udev cache would be generated;
# otherwise, we do not bother to read files.
readfiles $CMP_FILE_LIST
- echo "$READDATA" > /dev/shm/udev.cache
+ echo "$READDATA" > "$SYSCONF_TMP"
fi
fi
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
[ -f /etc/default/rcS ] && . /etc/default/rcS
DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
+SYSCONF_CACHED="/etc/udev/cache.data"
+SYSCONF_TMP="/dev/shm/udev.cache"
[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
@@ -24,13 +26,13 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
exit 0
fi
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
+if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
echo "Populating dev cache"
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 /dev/shm/udev.cache /etc/udev/cache.data
+ mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
fi
exit 0