[15/20] udev-cache: don't attempt to extract cache if it doesn't exist

Submitted by Ben Shelton on Aug. 4, 2014, 6:41 p.m.


Message ID d049bc1a6128679725415282e146a7f7db8be817.1407177403.git.ben.shelton@ni.com
State New
Headers show

Commit Message

Ben Shelton Aug. 4, 2014, 6:41 p.m.
From: Richard Tollerton <rich.tollerton@ni.com>

If you try to invalidate the udev cache solely by deleting the tarball,
while forgetting to also remove the config file ($DEVCACHE_SYSCONF),
then tar will fail.

Fortunately the cache will get regenerated on this boot because
$DEVCACHE_CURRENT_SYSCONF still exists, but to avoid the error, we
should check to see if the tarball actually exists before we try to
extract it.

Natinst-Rally-ID: TA44427
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
Natinst-ReviewBoard-ID: 58620
Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
 meta/recipes-core/udev/udev/init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index dc39d95..e4a196f 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -68,7 +68,7 @@  case "$1" in
 		    readfiles "$DEVCACHE_SYSCONF"
-		    if [ "$OLDDATA" = "$NEWDATA" ]; then
+		    if [ "$OLDDATA" = "$NEWDATA" -a -f "$DEVCACHE" ]; then
                             tar xzf $DEVCACHE -C / $DEVCACHE_EXTRACT_OPTS
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"