bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Any way to pass options to alternative compress program?


From: Davide Brini
Subject: Re: [Bug-tar] Any way to pass options to alternative compress program?
Date: Fri, 3 Aug 2012 09:22:09 +0200

On Thu, 02 Aug 2012 15:49:13 -0400, David Rosenstrauch <address@hidden>
wrote:

> I'm trying to make use of the --use-compress-program option of tar, to 
> use an alternative compression app when building my tarball.  However, 
> I'm trying to find a way to pass parameters to the compression program, 
> but I don't see any way to do that.
> 
> The alternative compression program I'm calling, pigz (a parallelizable 
> version of gzip compression), has a parameter -p to control the number 
> of CPU's to use in the parallelization.  But there doesn't seem to be 
> any way for me to pass that parameter from the tar command.  For 
> example, the following command doesn't work:
> 
> address@hidden code]$ tar  --use-compress-program "pigz -p 2" -cf 
> /tmp/test.tar.pgz .
> tar (child): pigz -p 2: Cannot exec: No such file or directory
> tar (child): Error is not recoverable: exiting now
> 
> Anyone know how I might accomplish this?

I too came across this just recently. Although the manual says that you can
do what you're trying to do, it doesn't work (it'd be nice it it did).
However, other options are: some programs allow to set their behavior
thorugh environment variables, so you may be able to do (I don't know
pigz but that's an example) eg

OPTIONP=2 tar -cv --use-compression-program=pigz -f foo.tpz2 etc.

otherwise, I'm afraid your only other option is to write a wrapper script
that invokes pigz with the needed arguments, and use that as compresion
program. Corrections welcome.

-- 
D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]