[11/20] udev-cache: parametrize tar options

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

Details

Message ID 8823f277843a307b6ddd3c46b4b57c9efc54bf64.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>

The options to pass to `tar` for cache create/extract are likely to
change due to system configuration circumstances (e.g. using busybox tar
instead of GNU tar). So move the more detailed options into
the defaults file to allow for easier overrides.

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 +-
 meta/recipes-core/udev/udev/udev-cache         | 2 +-
 meta/recipes-core/udev/udev/udev-cache.default | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 5db029a..dc39d95 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -69,7 +69,7 @@  case "$1" in
 		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            tar xzf $DEVCACHE -C / --exclude=log
+                            tar xzf $DEVCACHE -C / $DEVCACHE_EXTRACT_OPTS
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e "$DEVCACHE_CURRENT_SYSCONF" ] && rm -f "$DEVCACHE_CURRENT_SYSCONF"
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 7406e07..29700e0 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -26,7 +26,7 @@  fi
 if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
 	(
-		tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
+		tar czf "${DEVCACHE}.tmp" dev -C / $DEVCACHE_CREATE_OPTS
 		mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
 		mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
 	) &
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
index 7f39a68..30d7faa 100644
--- a/meta/recipes-core/udev/udev/udev-cache.default
+++ b/meta/recipes-core/udev/udev/udev-cache.default
@@ -6,4 +6,8 @@  DEVCACHE="/etc/udev-cache.tar.gz"
 DEVCACHE_SYSCONF="/etc/udev/cache.data"
 DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
 
+# - Avoid /dev/log because it's a pipe.
+DEVCACHE_EXTRACT_OPTS="--exclude=log"
+DEVCACHE_CREATE_OPTS="--exclude=log"
+
 PROBE_PLATFORM_BUS="yes"

Comments

Otavio Salvador Aug. 4, 2014, 7:44 p.m.
On Mon, Aug 4, 2014 at 3:41 PM, Ben Shelton <ben.shelton@ni.com> wrote:
> From: Richard Tollerton <rich.tollerton@ni.com>
>
> The options to pass to `tar` for cache create/extract are likely to
> change due to system configuration circumstances (e.g. using busybox tar
> instead of GNU tar). So move the more detailed options into
> the defaults file to allow for easier overrides.
>
> 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>

Same comment as 10/20.
Ben Shelton Aug. 4, 2014, 9:40 p.m.
On 08/04, Otavio Salvador wrote:
> On Mon, Aug 4, 2014 at 3:41 PM, Ben Shelton <ben.shelton@ni.com> wrote:
> > From: Richard Tollerton <rich.tollerton@ni.com>
> >
> > The options to pass to `tar` for cache create/extract are likely to
> > change due to system configuration circumstances (e.g. using busybox tar
> > instead of GNU tar). So move the more detailed options into
> > the defaults file to allow for easier overrides.
> >
> > 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>
> 
> Same comment as 10/20.
> 

In this one, I'm OK with setting the default in the scripts themselves,
since each environment variable is only used in one of the scripts.

Ben

> -- 
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750